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 Parameters = "(" ParameterList ")"
; ;
syntax ParameterList = ParamList syntax ParameterList = ParamList (";" ParamList)*;
| ParameterList ";" ParamList
;
/* /*
Observe you can declare multiple parametrs in a single delcaration. Observe you can declare multiple parametrs in a single delcaration.
Also note the 'var'. 'var' parameters are passed by reference, whereas non 'var' parameters 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 CompoundStatement = 'begin' StatementList? 'end';
syntax StatementList = Statement syntax StatementList = Statement (";" Statement)*;
| StatementList ";" Statement;
/* /*
We have: We have:
1. Assignment statements 1. Assignment statements

Loading…
Cancel
Save