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 --- chapter13/docs/13-grammar.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'chapter13') 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 ';' ; -- cgit v1.2.3