antlr lexeme value
assembly: instruction* EOF ;
@parser::members {
int[] code = new int[ExecuteVM.CODESIZE];
private int i = 0;
}
instruction:
PUSH n = INTEGER {code[i++] = PUSH;
code[i++] = Integer.parseInt($n.text);
}
/* Lexer rule */
PUSH : 'push' ;
INTEGER : '0' | ('-')?(('1'..'9')('0'..'9')*);