set basic repo structure
This commit is contained in:
32
grammar/MXLexer.g4
Normal file
32
grammar/MXLexer.g4
Normal file
@ -0,0 +1,32 @@
|
||||
lexer grammar MXLexer;
|
||||
|
||||
// Keywords
|
||||
INT: 'int';
|
||||
VOID: 'void';
|
||||
IF: 'if';
|
||||
ELSE: 'else';
|
||||
RETURN: 'return';
|
||||
|
||||
// Operators
|
||||
PLUS: '+';
|
||||
MINUS: '-';
|
||||
MULTIPLY: '*';
|
||||
DIVIDE: '/';
|
||||
ASSIGN: '=';
|
||||
|
||||
// Punctuation
|
||||
LPAREN: '(';
|
||||
RPAREN: ')';
|
||||
LBRACE: '{';
|
||||
RBRACE: '}';
|
||||
SEMICOLON: ';';
|
||||
|
||||
// Identifiers
|
||||
ID: [a-zA-Z_][a-zA-Z_0-9]*;
|
||||
|
||||
// Literals
|
||||
INT_LITERAL: [0-9]+;
|
||||
|
||||
// Whitespace and comments
|
||||
WS: [ \t\r\n]+ -> skip;
|
||||
COMMENT: '//' ~[\r\n]* -> skip;
|
Reference in New Issue
Block a user