From f4dee3cff700026b0997aac681752257aa03b4bd Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sat, 12 Oct 2024 14:02:50 -0700 Subject: update grammar files no idea if these are right, but seem closer to the mark --- chapter12/docs/12-grammar.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'chapter12/docs') 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 ';' ; -- cgit v1.2.3