The concrete syntax of the MURZ language is here shown. We highlight the fact that MURZ is very strict about the usage of semicolon, that has to be used only between two commands or to declarations in a sequence (it won't be used before end or else). Comments can be opened with // and end with the end of the line.
program |
::= | declListOpt block . |
| identListOpt | ::= |
|
| | | identList | |
| identList | ::= | identifier |
| | | identList , identifier | |
| declListOpt | ::= |
|
| | | declList ; | |
| declList | ::= | decl |
| | | declList ; decl | |
| args | ::= | typedIdentList |
| | | args ; typedIdentList | |
| decl | ::= | var typedIdentList |
| | | procedure identifier ; declListOpt block | |
| | | procedure identifier ( args ) ; declListOpt block | |
| typedIdentList | ::= | identList : typename |
| typename | ::= | integer |
| | | boolean | |
| expr | ::= | int |
| | | identifier | |
| | | ( expr ) | |
| | | expr + expr | |
| | | expr - expr | |
| | | expr * expr | |
| | | expr / expr | |
| | | expr and expr | |
| | | expr or expr | |
| | | expr > expr | |
| | | expr < expr | |
| | | expr = expr | |
| | | not expr | |
| block | ::= | begin commandSeq end |
|---|---|---|
| exprListOpt | ::= |
|
| | | exprList | |
| exprList | ::= | expr |
| | | exprList , expr | |
| command | ::= | skip |
| | | identifier ( exprListOpt ) | |
| | | read identifier | |
| | | write expr | |
| | | identifier := expr | |
| | | block | |
| | | while expr do command | |
| | | if expr then command else command | |
| commandSeq | ::= | commandSeq ; command |
| | | command | |