读书人

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

发布时间: 2012-06-03 16:59:40 作者: rapoo

编译原理 语法分析器 求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下也有

读书人网 >C语言

热点推荐