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 --- chapter14/docs/14-grammar.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'chapter14') 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 -- cgit v1.2.3