[11 - Antlr Parser] Fix grammar file and TestAntlrXScanner1#tokenID

This commit is contained in:
2020-05-27 12:41:27 +02:00
parent 9a3e3cfe97
commit 8fbf3095f0
19 changed files with 430 additions and 79 deletions

View File

@@ -14,16 +14,29 @@ grammar X;
options {
language = Java;
output = AST;
ASTLabelType = CommonTree;
backtrack = true;
}
// AST-Tokens
tokens {
DECL;
STATLIST;
DECLLIST;
UMINUS;
ID;
INTCONST;
WS;
}
@parser::header {package de.dhbw.compiler.antlrxparser;}
@lexer::header {package de.dhbw.compiler.antlrxparser;}
// Anmerkung: Es müssen Lexer- UND Parser-Regeln stehen, da sonst das Generieren nicht funktionieren
// Lexer stuff
ID: ('a'..'z' | 'A'..'Z')
(options {
greedy = true;
}: 'a'..'z' | 'A'..'Z' | '0'..'9')*;
INTCONST: ('0'..'9')+;
WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); };
// Parser stuff
program: 'TODO';