![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
编译原理
文章平均质量分 75
hello_tomorrow_111
这个作者很懒,什么都没留下…
展开
-
编译原理:用flex和bison实现一个简单的计算器
运用flex和bison工具实现一个简单的计算器,可以进行+、-、*、/等运算。 flex源代码格式: declarations %% translation rules %% auxiliary functions 语法分析器的自动构造: bison源代码格式: declarations %% translation rules %% supporting C rou原创 2017-12-03 22:03:28 · 4783 阅读 · 1 评论 -
编译原理:递归向下分析程序建立语法分析树的Java实现(一)
考虑如下的源语言消除first-first冲突和first-follow冲突后的文法:1) program -> block2) block -> {decls stmts}3) decls -> decl decls | ε4) decl -> type id;5) type -> basic | type’6) type’ -> [num]type’ | ε7) bas原创 2017-12-07 20:40:44 · 1313 阅读 · 0 评论 -
编译原理:递归向下分析程序建立语法分析树的Java实现(二)
在上一篇文章中,我们已经得到了LL(1)文法,现在,我们使用java编写递归向下的语法分析程序开建立语法分析树。当一个文法满足LL(1)条件时,我们就可以为它构造一不带回溯的自上而下的分析程序,这个分析程序时由一组递归过程组成的,每个过程对应文法的一个非终结符。程序实现代码:Mainpublic class Main { public static void main(Stri原创 2017-12-07 21:01:50 · 2763 阅读 · 1 评论 -
编译原理:使用flex和bison工具实现语法分析树的建立
在我的另外两篇文章中介绍了语法分析树建立的Java实现,这次使用flex和bison在Unix环境下完成语法分析树的建立flex介绍bison介绍关于flex和bison的使用和语法在这里就不详细的介绍了。如果你的Unix环境没有装这两个工具可以使用如下命令进行安装(机器需要连接网)sudo apt-get install bisonsudo apt-get install flex按照提示属于“原创 2017-12-07 21:24:40 · 11702 阅读 · 6 评论