1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- TODO:
- SwitchCASE incompleto
- */
- grammar GrammarAddress;
- assing
- : expression EOF
- ;
- expression
- : R_PAR_E expression R_PAR_D #expr_par
- | expression op=R_OP_MULT expression #expr_arit_md
- | expression op=R_OP_ADD expression #expr_arit_as
- | T_INTEIRO #expr_integer
- | variable #expr_id
- ;
- variable
- : modificator? ID
- ;
- modificator
- : '.' //type
- | '_' //variable
- ;
- //DEFINICAO DE TOKENS ----------------------------------------------------------
- R_PAR_E : '(';
- R_PAR_D : ')';
- R_CHA_E : '[';
- R_CHA_D : ']';
- R_OP_ADD : '+';
- R_OP_MULT : '*';
- fragment DIGITO : [0-9] ;
- fragment CHARACTER : [a-zA-Z_] ;
- fragment CHARACTER_UP: [A-Z];
- ID : CHARACTER ( CHARACTER | DIGITO )* ;
- T_INTEIRO : DIGITO+ ;
- R_LINE_COMMENT : '//' .*? '\r'? '\n' -> skip ; // Match "#" stuff '\n'
- R_WS : (' '|'\t'|'\r'|'\n')+ -> skip ;
- R_COMMENT : '/*' .*? '*/' -> skip ; // Match "/*" stuff "*/"
|