[11 - Antlr Parser] Add global library and add implementation for "CC-Praxis-Antlr Parser fuer X-Leer"/AntlrXParseMain

This commit is contained in:
2020-05-27 12:07:14 +02:00
parent 7d7b787c80
commit 9a3e3cfe97
14 changed files with 362 additions and 238 deletions

View File

@@ -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

View File

@@ -0,0 +1,33 @@
/* **********************************************
* 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;
}
// AST-Tokens
tokens {
DECL;
STATLIST;
DECLLIST;
UMINUS;
}
@parser::header {package de.dhbw.compiler.antlrxparser;}
@lexer::header {package de.dhbw.compiler.antlrxparser;}
INVALID: .;
program: 'TODO';