CompilerTech

导航

随笔分类 -  计算机科学-编译原理

目前正在学习《Compilers principles,Technologys,&tools》
2.3 节的练习
摘要:2.3 节的练习2.3.1构建一个语法制导翻译方案,该方案把算数表达式从中缀表达式翻译成前缀表达式。解答产生式:expr -> expr + term | expr - term | termterm -> term * factor | term / factor | factorfactor -> digit | (expr)翻译方案:expr -> {print("+")} expr + term | {print("-")} expr - term | termterm -> {print("*" 阅读全文

posted @ 2014-03-06 16:29 compilerTech 阅读(1381) 评论(0) 推荐(0)

2.2 节的练习--Compiler principles, technologys, &tools
摘要:2.2 节的练习2.2.1考虑下面的上下文无关文法:S -> S S + | S S * | a试说明如何使用该文法生成串 aa+a*试为这个串构造一颗语法分析树⧗ 该文法生成的语言是什么?试证明解答S -> S S * -> S S + S * -> a S + S * -> a a + S * -> a a + a *把 a 看成是运算数,L = {支持加法和乘法的表达式的后缀表示形式}2.2.2下面各个文法生成什么语言?证明你的每一个答案S -> 0 S 1 | 0 1S -> + S S | - S S | aS -> S ( S 阅读全文

posted @ 2014-03-06 16:27 compilerTech 阅读(1861) 评论(0) 推荐(0)

Compiler Chapter1 Test
摘要:Chapter 1 Introduction Programming languages are notations for describing computations to people and to machines. The world as we know it depends on programming languages, because all the software run... 阅读全文

posted @ 2012-01-08 19:27 compilerTech 阅读(384) 评论(0) 推荐(0)

Compiler
摘要:CompilersPrinciples, Techniques, & ToolsSecond EditionAlfred V. AboColumbia UniversityMonica S. LamStanford UniversityRavi SethiAvayaJeffrey D. UllmanStanford University PublisherGreg TobinExecutive EditorMichael HirschAcquisitions EditorMatt GoldsteinProject EditorKatherine HarutunianAssociate 阅读全文

posted @ 2012-01-08 12:04 compilerTech 阅读(2890) 评论(0) 推荐(0)

状态机相关
摘要:在实际的应用中,根据有限状态机是否使用输入信号,设计人员经常将其分为Moore型有限状态机和Mealy型有限状态机两种类型。1 Moore型有限状态机 其输出信号仅与当前状态有关,即可以把Moore型有限状态的输出看成是当前状态的函数。2 Mealy型有限状态机 其输出信号不仅与当前状态有关,而且还与所有的输入信号有关,即可以把Mealy型有限状态机的输出看成是当前状态和所有输入信号的函数。 Finite State Machine: 有限状态机(FSM)或有限状态自动机或简称状态机,是表示有限个状态以及在这些状态之间的转移和动作等行为的数学模型. 简单说明一下,可以这样理解,系统的行为如.. 阅读全文

posted @ 2012-01-05 10:29 compilerTech 阅读(403) 评论(0) 推荐(0)