【文件属性】:
文件名称:解释器(Interpreter),自定义语法(类C)
文件大小:591KB
文件格式:RAR
更新时间:2014-03-05 07:54:10
解释器 编译 自动机 剖析树
"程序语言"这门课的课程实验。
给一个自定义语法的语言写一个解释器(Interpreter),首先写了Parser,然后存入剖析树(Parse Tree)对象中,最后根据Parse Tree的结构执行程序,计算出结果。
语法如下:
::= program (1) begin end
::= | (2)
::= | (3)
::= int ; (4)
::= | , (5)
::= |||| (6)
::= = ; (7)
::= if then end; (8) |if then else end;
::= while loop end; (9)
::= read ; (10)