summaryrefslogtreecommitdiff
path: root/chapter13/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 /chapter13/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 'chapter13/docs')
-rw-r--r--chapter13/docs/13-grammar.md10
1 files changed, 8 insertions, 2 deletions
diff --git a/chapter13/docs/13-grammar.md b/chapter13/docs/13-grammar.md
index 65611618..63871a39 100644
--- a/chapter13/docs/13-grammar.md
+++ b/chapter13/docs/13-grammar.md
@@ -20,8 +20,14 @@ statement
| metaStatement
;
+PRIMTYPE
+ : 'int'
+ | 'flt'
+ ;
+
field
- : 'int' IDENTIFIER ';'
+ : PRIMTYPE IDENTIFIER ';'
+ | structName IDENTIFIER ('?')? ';'
;
fields
@@ -66,7 +72,7 @@ structName
;
declStatement
- : 'int' IDENTIFIER '=' expression ';'
+ : PRIMTYPE IDENTIFIER '=' expression ';'
| structName IDENTIFIER ('?')? '=' expression ';'
;