-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path简化文法.txt
70 lines (39 loc) · 1.2 KB
/
简化文法.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
1. <pro>→<mainkey>(){<des><sts>}
2. <des>→<ses><des>|<null>
3. <ses>→<intkey><idt>;
4. (1)<idt>→<id><idts>
(2)<idts>→,<idt>|null
5. <sts>→<sent><sts>|null
6. <sent>→<ifs>|<whiles>|<fors>|<scanfs>|<printfs>
|<coms>|<asst>
7.(1) <ifs>→<ifkey> (<exp>)<coms><elses>
(2)<elses>→<eleskey><coms>|null
8. <whiles>→<whilekey> (<exp>)<coms>;
9. <fors>→<forkey> (<exp>;<exp>;<exp>) <coms>;
10. <coms>→{<sts>}
11. <asst>→<exp>;
12. (1)<exp>→<id><exps>
(2)<exps>→=<arit>|<rel>
13. (1)<rel>→<opt><relop><arit>|null
(2)<opt>→+<arit>|-<arit>|*<term>|/<term>|null
14. (1)<relop>→><eq>|<<eq>|=<eq>|!<eq>
(2)<eq>→=|null
15. (1)<arit>→<term><oparit>
(2)<oparit>→+<arit>|-<arit>|null
16. (1)<term>→<factor><opterm>
(2)<opterm>→*<term>|/<term>|null
17. <factor>→<id>|<unint>|(<arit>)
18.(1)<id>→<idh><idta>
(2)<idh>→<letter>
(3)<idta>→<letter><idta>|<num><idta>|<null>
19. <unint>→<num><unint>|<null>
20. <letter>→a|b|…|z|A|B|…|Z
21. <num>→0|1|2|3|4|5|6|7|8|9
22. <mainkey>→main
23. <ifkey>→if
24. <eleskey>→else
25. <whilekey>→while
26. <forkey>→for
27. <intkey>→int
28. <scanfs>→<scanfkey>(id);
29. <printfkey>→<printfkey>(id);