c或c ++源代码中的逻辑解析树 [英] logical parse tree in c or c++ source code
本文介绍了c或c ++源代码中的逻辑解析树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要逻辑操作数的完整源代码解析树
!!!!用c ++或c#
谁能尽快帮助我。 ..?!
非常感谢我的朋友......
i need a full source code for logical operands parse tree
!!!!in c++ or c#
who help me as soon as he\she can...?!
thanks alot my friends...
推荐答案
您是一名软件开发人员,对吗?因此,你应该写'完整的源代码'。
解析的主题是一个非常有趣的主题,我建议你阅读一本好书。也就是说,您可能会发现许多表达式解析的例子只是 Google搜索。
You are a software developer, right? Hence you are supposed to write 'full source code'.
The very topic of parsing is a fascinating one, I suggest you to read a good book about. That said, you may find many, many examples of expression parsing just Googling for.
首先定义语法,例如:
First define the grammar, e.g.:
Expr = LogicOrExpr .
LogicOrExpr = LogicAndExpr { '||' LogicAndExpr } .
LogicAndExpr = LogicNotExpr { '&&' LogicNotExpr } .
LogicNotExpr = { '!' } PrimaryExpr .
PrimaryExpr = NestedExpr | NameExpr | LiteralExpr .
NestedExpr = '(' Expr ')' .
NameExpr = IDENTIFIER .
LiteralExpr = 'true' | 'false' .
然后定义合适的类定义以保存上面的相应产品。
最后选择一个您选择的编译器 - 编译器工具并实现它。或者,您可以轻松地从给定的作品中编写一个自上而下的解析器。
干杯
Andi
Then define suitable class definition(s) to hold the respective productions above.
Finally take a Compiler-Compiler tool of your choice and implement it. Alternatively, you may easily write a top-down parser from the given productions.
Cheers
Andi
这篇关于c或c ++源代码中的逻辑解析树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文