📄 cfl.txt
字号:
编译原理实验文法——LR文法
一、说明语句
1. P→D (p.at=d.at)
2. D→DM (d.at=m.at)
3. D→M (d.at=m.at)
4. M→id:I; (fill(entry(id),i.at);m.at=i.at))
5. M→id(){DL}
6. I→int (i.at=int)
二、表达式
7. E→E+T (e.place=newtemp;gen(+,e1.place,t.place,e.place))
8. E→T (e.place=t.place)
9. T→T*F (t.place=newtemp;gen(*,t1.place,f.place,t.place))
10. T→F (t.place=f.place)
11. F→id (f.place=entry(id))
12. F→(E) (gen(=,e.place,_,f.place))
13. F→constant (常数) (f.place=entry(constant))
三、布尔表达式
14. B→B and C (b.place=newtemp;gen(and,b1.place,c.place,b.place))
15. B→C (b.place=c.place)
16. C→(B) (gen(=,e.place,_,f.place))
17. C→E<E (e.place=newtemp;gen(<,e1.place,e2.place,c.place))
18. C→true (gen(=,'1',_,e.place))
四、句法
19. L→LS
20. L→S
21. S→{L}
22. S→id=E; (gen(=,e.place,_,entry(id)))
23. S→while(B) S
24. S→if(B) S
25. S→if(B) S else S
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -