逻辑表达式解析器树 [英] Logical Expression Parser Tree

查看:164
本文介绍了逻辑表达式解析器树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我正在研究逻辑表达式的C ++/c#算法和实现.我想要这个逻辑表达式,例如,k =(((((a + b)''c)+((d + e)''f))g产品形式如abc''+ bdf''+ ....为此,我计划将表达式放在树中,如:
.
| |
+ g
|
不是.
..
..
.. 等等.然后,我将应用de-morgan规则,并在最后一步应用+上的乘积分布定律.但是,我面临着实施方面的问题.在我的研究过程中,许多人正在使用Linq.Expression系统类,或者有些文章是有关Evaluant.Anltr框架来创建树的.我想表明我不想评估逻辑表达式.我只想拥有产品总和"表格.有谁做过类似的事情,所以可以给我一些提示吗?也许我不希望有源代码或smt,但至少可以从中获得一些技巧或指导来创建分层树
最好的问候

Hello,
I am working on an algorithm and perhaps an implementation in C++/c# for logical expressions. I want this logical expression for example, k = ((((a+b)''c)+((d+e)''f))g. My task is to put this expression in a short DNF / Sum of Products form such as abc''+bdf''+.... To do this I planned to put the expression in a tree like :
.
| |
+ g
|
Not.
..
..
.. and so on. Then I will apply de-morgan rule and at the last step Distribution law of multiplication over +. However I am facing problems about implementation. During my research many people are using Linq.Expression system classes or some articles are about Evaluant.Anltr framework to create tree. I want to indicate that I do not want to evaluate the logical expression. I just want to have Sum of Products form. Is there anyone who did similar thing so can give me some hints? Perhaps I dont expect a source code or smt but at least it will be nice to get some tips or guidence to create a hierarchic tree
Best regards

推荐答案

(希望我明白了)ANTLR很棒.
ANTLR网页[ ^ ]包含教程,参考文档,示例语法.
:)
(Hope I got you) ANTLR is great at this.
the ANTLR web page [^] has tutorials, reference documentation, sample grammars.
:)


您是否可以为ANTLR提供任何教程或示例?
Is there any tutorial or example that you can provide for ANTLR?


这篇关于逻辑表达式解析器树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆