Created
November 8, 2019 01:16
-
-
Save thauansrx/d7af28232551d066d30f019f014d498e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar aps_compiladores_c_rec; | |
/* | |
Executar | |
antlr4 Aps.g4 | |
javac Aps*.java | |
grun Aps prog -gui input.txt | |
*/ | |
/* | |
Funciona a regra de precedentes mas contem recursão a esquerda | |
*/ | |
prog: (atribuicao EOF)*; | |
atribuicao: IDENTIFICADOR OP_ATRIB expr1 PV; | |
expr1 : expr1 expr2 | expr1 OP_ARIT1 expr1| expr2; | |
expr2 : expr2 OP_ARIT2 expr2 | valor; | |
valor : IDENTIFICADOR | NUMERO; | |
IDENTIFICADOR : [a-z] ( [a-z] | [0-9] | [_] )*; | |
OP_ATRIB: [=]; | |
NUMERO: [0-9]+ | [0-9]+ '.' [0-9]+; | |
OP_ARIT1: [*/]; | |
OP_ARIT2: [+-]; | |
PV: [;]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment