Force declarations at the beginning
This commit is contained in:
parent
ee4ec4f3f9
commit
7d65980c4f
1 changed files with 8 additions and 4 deletions
12
as.y
12
as.y
|
@ -49,30 +49,34 @@
|
|||
|
||||
S : Main ;
|
||||
|
||||
Main : tINT tMAIN tPO Params tPF Body ;
|
||||
Main : tINT tMAIN tPO Params tPF MainBody ;
|
||||
|
||||
Params : | Param SuiteParams ;
|
||||
Param : tINT tID ;
|
||||
|
||||
SuiteParams : tVIRG Param SuiteParams ;
|
||||
|
||||
MainBody : tAO Declarations Instructions tAF ;
|
||||
|
||||
Body : tAO Instructions tAF ;
|
||||
|
||||
Instructions : Instruction Instructions | ;
|
||||
|
||||
Instruction : Aff | Printf | If | Declaration ;
|
||||
Instruction : Aff | Printf | If ;
|
||||
|
||||
Aff : tID tEQ E tPV ;
|
||||
|
||||
E : tNB | tID | E tADD E | E tMUL E | E tSUB E | E tDIV E | tPO E tPF | tSUB E ;
|
||||
|
||||
DeclarationBody : tID tVIRG DeclarationBody | tID ;
|
||||
Declarations : | Declaration Declarations ;
|
||||
|
||||
Declaration : DeclarationInt | DeclarationConst ;
|
||||
|
||||
DeclarationInt : tINT DeclarationBody tPV ;
|
||||
|
||||
DeclarationConst : tCONST DeclarationBody tPV ;
|
||||
|
||||
Declaration : DeclarationInt | DeclarationConst ;
|
||||
DeclarationBody : tID tVIRG DeclarationBody | tID ;
|
||||
|
||||
If : IfSimple | IfElse ;
|
||||
|
||||
|
|
Loading…
Reference in a new issue