You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/TinyC/README.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Tiny-C
1
+
# Tiny-C
2
2
3
3
This project implements a parser for the [Tiny-C](http://www.iro.umontreal.ca/~felipe/IFT2030-Automne2002/Complements/tinyc.c) language, a highly simplified version of `C` designed as an educational tool for learning about compilers.
4
4
@@ -11,7 +11,7 @@ The main differences from the original `Tiny-C` are:
11
11
## Tiny-C Grammar
12
12
13
13
```sh
14
-
start:
14
+
start
15
15
= S statement EOF
16
16
;
17
17
@@ -20,10 +20,12 @@ keyword
20
20
;
21
21
22
22
number
23
-
= [0-9]+;
23
+
= [0-9]+
24
+
;
24
25
25
26
variable
26
-
= !keyword [a-zA-Z_][a-zA-Z0-9_]*;
27
+
= !keyword [a-zA-Z_][a-zA-Z0-9_]*
28
+
;
27
29
28
30
S
29
31
= [ \t\n\r]*
@@ -43,34 +45,34 @@ number_expr
43
45
44
46
expr
45
47
= assigment_expr
48
+
/ ternary_expr
46
49
;
47
50
48
51
assigment_expr
49
52
= var_expr "=" S expr
50
-
/ ternary_expr
51
53
;
52
54
53
55
ternary_expr
54
-
= or_expr ("?" S expr ":" S ternary_expr)?
56
+
= logical_or_expr ("?" S expr ":" S ternary_expr)?
0 commit comments