summaryrefslogtreecommitdiff
path: root/chapter12/docs
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 /chapter12/docs
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 'chapter12/docs')
-rw-r--r--chapter12/docs/12-grammar.md9
1 files changed, 7 insertions, 2 deletions
diff --git a/chapter12/docs/12-grammar.md b/chapter12/docs/12-grammar.md
index 8048bb8c..a576bd7a 100644
--- a/chapter12/docs/12-grammar.md
+++ b/chapter12/docs/12-grammar.md
@@ -20,8 +20,13 @@ statement
| metaStatement
;
+PRIMTYPE
+ : 'int'
+ | 'flt'
+ ;
+
field
- : 'int' IDENTIFIER ';'
+ : PRIMTYPE IDENTIFIER ';'
;
fields
@@ -66,7 +71,7 @@ structName
;
declStatement
- : 'int' IDENTIFIER '=' expression ';'
+ : PRIMTYPE IDENTIFIER '=' expression ';'
| structName IDENTIFIER ('?')? '=' expression ';'
;