Made grammar a bit clearer

main
channa 10 months ago
parent 34cffcb4f8
commit 32d290b743

@ -54,9 +54,7 @@ syntax SubProgDecl = 'function' Id Parameters ":" BasicType ";" VarDecl*
syntax Parameters = "(" ParameterList ")"
;
syntax ParameterList = ParamList
| ParameterList ";" ParamList
;
syntax ParameterList = ParamList (";" ParamList)*;
/*
Observe you can declare multiple parametrs in a single delcaration.
Also note the 'var'. 'var' parameters are passed by reference, whereas non 'var' parameters
@ -70,8 +68,7 @@ syntax ParamList = 'var'? IdList ":" TypeSpec
syntax CompoundStatement = 'begin' StatementList? 'end';
syntax StatementList = Statement
| StatementList ";" Statement;
syntax StatementList = Statement (";" Statement)*;
/*
We have:
1. Assignment statements

Loading…
Cancel
Save