diff options
Diffstat (limited to 'ecomp-c/minie.ebnf')
-rw-r--r-- | ecomp-c/minie.ebnf | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/ecomp-c/minie.ebnf b/ecomp-c/minie.ebnf index be68ba8..2bf9708 100644 --- a/ecomp-c/minie.ebnf +++ b/ecomp-c/minie.ebnf @@ -9,7 +9,7 @@ Character = "'" Digit | Letter | Special | "'" . String = """" { Character } """" . # parser -Factor = Number | Character | String | Identifier [ "[" Expression "]" ] | "(" Expression ")" | "not" Factor . +Factor = Number | Character | String | Identifier [ "[" Expression "]" | ParameterList ] | "(" Expression ")" | "not" Factor . Term = Factor { ( "*" | "/" | "mod" | "and" ) Factor } . SimpleExpression = Term { ( "+" | "-" | "or" ) Term } . RelationalOperator = "=" | "<>" | "<" | ">" | "<=" | ">=" . @@ -21,7 +21,6 @@ ParameterList = "(" Expression { "," Expression } ")" . ProcedureCall = Identifier [ ParameterList ] . Statement = Assignment | IfStatement | WhileStatement | ProcedureCall . StatementSequence = Statement { ";" Statement } . -StatementBlock = "begin" StatementSequence "end" . SimpleType = Identifier . ArrayType = "array" [ ConstExpression ] "of" Type . Type = SimpleType | ArrayType . @@ -31,9 +30,9 @@ ConstBlock = "const" { ConstDeclaration ";" } . VariableDeclaration = Identifier { "," Identifier } ":" Type [ ":=" ConstExpression ] . VariableBlock = "var" { VariableDeclaration ";" } . ParameterDeclaration = Identifier ":" Type . -ParamaterDeclarationList = "(" ParameterDeclaration { "," ParameterDeclaration } ")" . -ProcedureDeclaration = "procedure" Identifier [ ParamaterDeclarationList ] ";" ProcedureDeclarationBlock StatementBlock . +ParamaterDeclarationList = "(" ParameterDeclaration { "," ParameterDeclaration } ")" [ ":" Type ] . +ProcedureDeclaration = [ "procedure" | "function" ] Identifier [ ParamaterDeclarationList ] ";" ProcedureDeclarationBlock "begin" StatementSequence [ "return" Type ] "end" . ProcedureDeclarationBlock = [ ConstBlock ] [ VariableBlock ] . ProcedureBlock = { ProcedureDeclaration } . DeclarationBlock = [ ConstBlock ] [ VariableBlock ] [ ProcedureBlock ] . -Module = "module" Identifier ";" DeclarationBlock StatementBlock . +Module = "module" Identifier ";" DeclarationBlock "begin" StatementSequence "end" . |