Re-init IntelliJ project
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
T__20=20
|
||||
T__21=21
|
||||
T__22=22
|
||||
T__23=23
|
||||
T__24=24
|
||||
T__25=25
|
||||
T__26=26
|
||||
T__27=27
|
||||
T__28=28
|
||||
T__29=29
|
||||
T__30=30
|
||||
T__31=31
|
||||
T__32=32
|
||||
T__33=33
|
||||
T__34=34
|
||||
T__35=35
|
||||
T__36=36
|
||||
T__37=37
|
||||
T__38=38
|
||||
T__39=39
|
||||
T__40=40
|
||||
T__41=41
|
||||
T__42=42
|
||||
T__43=43
|
||||
T__44=44
|
||||
T__45=45
|
||||
COMMENT=4
|
||||
DECL=5
|
||||
DECLLIST=6
|
||||
DIGIT=7
|
||||
FLOATCONST=8
|
||||
ID=9
|
||||
INTCONST=10
|
||||
INVALID=11
|
||||
LETTER=12
|
||||
OTHER=13
|
||||
POSDIGIT=14
|
||||
STATLIST=15
|
||||
STRINGCONST=16
|
||||
UMINUS=17
|
||||
WS=18
|
||||
ZERO=19
|
||||
'('=20
|
||||
')'=21
|
||||
'*'=22
|
||||
'+'=23
|
||||
'-'=24
|
||||
'.'=25
|
||||
'/'=26
|
||||
':'=27
|
||||
':='=28
|
||||
';'=29
|
||||
'<'=30
|
||||
'='=31
|
||||
'>'=32
|
||||
'begin'=33
|
||||
'else'=34
|
||||
'end'=35
|
||||
'float'=36
|
||||
'for'=37
|
||||
'if'=38
|
||||
'int'=39
|
||||
'print'=40
|
||||
'program'=41
|
||||
'read'=42
|
||||
'string'=43
|
||||
'then'=44
|
||||
'while'=45
|
||||
Binary file not shown.
@@ -0,0 +1,44 @@
|
||||
/* **********************************************
|
||||
* Duale Hochschule Baden-Württemberg Karlsruhe
|
||||
* Prof. Dr. Jörn Eisenbiegler
|
||||
*
|
||||
* Vorlesung Übersetzerbau
|
||||
* Praxis ANTLR-Parser für X
|
||||
* - Grammatik für Scanner und Parser
|
||||
*
|
||||
* **********************************************
|
||||
*/
|
||||
|
||||
grammar X;
|
||||
|
||||
options {
|
||||
language = Java;
|
||||
output = AST;
|
||||
ASTLabelType = CommonTree;
|
||||
backtrack = true;
|
||||
}
|
||||
|
||||
// AST-Tokens
|
||||
tokens {
|
||||
ID;
|
||||
INTCONST;
|
||||
FLOATCONST;
|
||||
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; // Lese alle möglichen Zeichen ein -> Zahlen in ID -> bleibt weiterhin ID
|
||||
}: 'a'..'z' | 'A'..'Z' | '0'..'9')*;
|
||||
INTCONST: ('0'..'9')+;
|
||||
FLOATCONST: INTCONST '.' INTCONST;
|
||||
|
||||
WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); };
|
||||
|
||||
// Parser stuff
|
||||
program: 'TODO';
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user