我正在为C做一个静态分析器.我已经使用ANTLR完成了词法分析器和解析器,其中生成了Java代码.
ANTLR会自动为我们构建AST options {output=AST;}吗?或者我必须自己制作树?如果是,那么如何吐出AST上的节点?
我目前认为AST上的节点将用于制作SSA,然后进行数据流分析以制作静态分析器.我在正确的道路上吗?
现在已经有一段时间了,我试图让自己在Javascript中为org-mode编写解析器.我在解析大纲时没有遇到任何麻烦(我在几分钟内就完成了),但解析实际内容要困难得多,例如,我遇到了叠加列表的问题.
* This is a heading
P1 Start a paragraph here but since it is the first indentation level
the paragraph may have a lower indentation on the next line
or a greater one for that matter.
+ LI1.1 I am beginning a list here
+ LI1.2 Here begins another list item
which continues here
and also here
P2 but is broken here (this line becomes a paragraph
outside of the first list).
+ LI2.1 P1 Second list …Run Code Online (Sandbox Code Playgroud)