summaryrefslogtreecommitdiff
path: root/chapter14/docs/14-grammar.md
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2024-10-12 14:02:50 -0700
committerCliff Click <cliffc@acm.org>2024-10-13 09:49:57 -0700
commitf4dee3cff700026b0997aac681752257aa03b4bd (patch)
treef843232a06aa4f3e5101e09ee218ac414c1cc90a /chapter14/docs/14-grammar.md
parent96d028ce004f5b4581997fd1d1a0ccfa87d67ea3 (diff)
downloadSimple-f4dee3cff700026b0997aac681752257aa03b4bd.tar.gz
Simple-f4dee3cff700026b0997aac681752257aa03b4bd.zip
update grammar files
no idea if these are right, but seem closer to the mark
Diffstat (limited to 'chapter14/docs/14-grammar.md')
-rw-r--r--chapter14/docs/14-grammar.md11
1 files changed, 6 insertions, 5 deletions
diff --git a/chapter14/docs/14-grammar.md b/chapter14/docs/14-grammar.md
index 4534684d..d7b11d24 100644
--- a/chapter14/docs/14-grammar.md
+++ b/chapter14/docs/14-grammar.md
@@ -20,7 +20,7 @@ statement
| metaStatement
;
-type
+PRIMTYPE
: 'int'
| 'i8'
| 'i16'
@@ -34,9 +34,10 @@ type
| 'f64'
| 'bool'
;
-
+
field
- : type IDENTIFIER ';'
+ : PRIMTYPE IDENTIFIER ';'
+ | structName IDENTIFIER ('?')? ';'
;
fields
@@ -81,7 +82,7 @@ structName
;
declStatement
- : type IDENTIFIER '=' expression ';'
+ : PRIMTYPE IDENTIFIER '=' expression ';'
| structName IDENTIFIER ('?')? '=' expression ';'
;
@@ -110,7 +111,7 @@ additiveExpression
;
multiplicativeExpression
- : unaryExpression (('*' | '|') unaryExpression)*
+ : unaryExpression (('*' | '/') unaryExpression)*
;
unaryExpression