首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

编译原理 语法分析器 求LR分析表解决办法

2012-06-03 
编译原理 语法分析器求LR分析表编程语言语法的描述program ? compoundstmtstmt ?ifstmt|whilestmt|assgstm

编译原理 语法分析器 求LR分析表
编程语言语法的描述

program ? compoundstmt
stmt ? ifstmt | whilestmt | assgstmt | compoundstmt
compoundstmt ? { stmts }
stmts ? stmt stmts | ?
ifstmt ? if ( boolexpr ) then stmt else stmt
whilestmt ? while ( boolexpr ) stmt
assgstmt ? ID = arithexpr ;
boolexp ? arithexpr boolop arithexpr
boolop ? < | > | <= | >= | ==
arithexpr ? multexpr arithexprprime
arithexprprime ? + multexpr arithexprprime | - multexpr arithexprprime | ?
multexpr ? simpleexpr multexprprime
multexprprime ? * simpleexpr multexprprime | / simpleexpr multexprprime | ?
simpleexpr ? ID | NUM | ( arithexpr )


[解决办法]
yacc + lex,没事的话可以试试

你有兴趣的话,antlr来做也很简单

手工做语法树确实比较累
[解决办法]

探讨

引用:

yacc + lex,没事的话可以试试

你有兴趣的话,antlr来做也很简单

手工做语法树确实比较累
怎么使用那个软件?下载的都很少啊。

[解决办法]
探讨

引用:

引用:

yacc + lex,没事的话可以试试

你有兴趣的话,antlr来做也很简单

手工做语法树确实比较累
怎么使用那个软件?下载的都很少啊。


yacc在bison里面有bison -y,lex在flex里面

你可以试试在linux下试试,windows下也有

热点排行