|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
module Syntax
|
|
|
|
|
|
|
|
|
|
extend lang::std::Whitespace;
|
|
|
|
|
extend lang::std::Id;
|
|
|
|
|
extend lang::std::ASCII;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -108,7 +107,7 @@ syntax Lhs = Id ("[" Expr "]")?
|
|
|
|
|
|
|
|
|
|
syntax SubProgCall = 'readln'"(" LhsList ")"
|
|
|
|
|
| 'writeln'"(" ExprList ")"
|
|
|
|
|
> Id \ 'writeln' \ 'readln' \ 'skip' ("(" ExprList ")")?
|
|
|
|
|
> Id ("(" ExprList ")")?
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
syntax ExprList = Expr ("," Expr)*
|
|
|
|
@ -138,6 +137,14 @@ syntax Expr = "(" Expr ")"
|
|
|
|
|
/*
|
|
|
|
|
Basic lexical constructs.
|
|
|
|
|
*/
|
|
|
|
|
keyword Reserved = 'program' | 'const' | 'var' | 'array' | 'of' | 'integer'
|
|
|
|
|
| 'real' | 'function' | 'procedure' | 'begin' | 'end'
|
|
|
|
|
| 'skip' | 'if' | 'then' | 'else' | 'while' | 'do' | 'not'
|
|
|
|
|
| 'or' | 'and' | 'readln' | 'writeln'
|
|
|
|
|
;
|
|
|
|
|
lexical Id = ([a-z A-Z 0-9 _] !<< [a-z A-Z][a-z A-Z 0-9 _]* !>> [a-z A-Z 0-9 _]) \ Reserved
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
lexical Relop = "\<"|"\<="|"\>"|"\>="|"="|"\<\>";
|
|
|
|
|
lexical Number = Digit+
|
|
|
|
|
| Digit* "." Digit+
|
|
|
|
|