Trabalho de compiladores PUC-MG desenvolvido em Java.
Grupo:
Parte | Valor | Nota |
---|---|---|
Analise Léxica/Sintática | 10 | 10 |
Analise Semântica | 20 | 20 |
Automato:
Gramática:
-
S-> {D}+ main {C}+end
-
D-> (integer | boolean | byte | string) id [= [-]v_const] {,id [= [-]v_const]}; | const id = [-]v_const;
-
C-> id = EXP;| while ‘(‘ EXP ’)’ W | if ‘(‘EXP’)’ then ( C [else (W) ] | begin {C} end [else (W) ] ) | ; | readln’(‘ id ’)’; | (write | writeln)’(‘ EXP{,EXP} ’)’;
-
W-> begin {C} end | C
-
EXP-> EXPS [(==|!=|<|>|<=|>=) EXPS]
-
EXPS-> [+|-] T {(+|-|or) T}
-
T-> F {(*|and|/) F}
-
F-> ‘(‘ EXP ’)’| id | v_const | not F