diff --git a/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/libraries/antlr_3_5_2_complete.xml b/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/libraries/antlr_3_5_2_complete.xml
deleted file mode 100644
index aa5a3ea..0000000
--- a/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/libraries/antlr_3_5_2_complete.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/libraries/lib.xml b/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/libraries/lib.xml
new file mode 100644
index 0000000..5431a80
--- /dev/null
+++ b/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/libraries/lib.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/modules.xml b/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/modules.xml
index f051285..c1c79b3 100644
--- a/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/modules.xml
+++ b/CC-Praxis-Antlr Baumgrammatiken-Leer/.idea/modules.xml
@@ -4,6 +4,7 @@
+
\ No newline at end of file
diff --git a/CC-Praxis-Antlr Baumgrammatiken-Leer/CC-Praxis-Antlr Baumgrammatiken-Leer.iml b/CC-Praxis-Antlr Baumgrammatiken-Leer/CC-Praxis-Antlr Baumgrammatiken-Leer.iml
index aba1c22..fb8e866 100644
--- a/CC-Praxis-Antlr Baumgrammatiken-Leer/CC-Praxis-Antlr Baumgrammatiken-Leer.iml
+++ b/CC-Praxis-Antlr Baumgrammatiken-Leer/CC-Praxis-Antlr Baumgrammatiken-Leer.iml
@@ -7,6 +7,6 @@
-
+
\ No newline at end of file
diff --git a/CC-Praxis-Antlr Baumgrammatiken/CC-Praxis-Antlr Baumgrammatiken.iml b/CC-Praxis-Antlr Baumgrammatiken/CC-Praxis-Antlr Baumgrammatiken.iml
index c90834f..fb8e866 100644
--- a/CC-Praxis-Antlr Baumgrammatiken/CC-Praxis-Antlr Baumgrammatiken.iml
+++ b/CC-Praxis-Antlr Baumgrammatiken/CC-Praxis-Antlr Baumgrammatiken.iml
@@ -7,5 +7,6 @@
+
\ No newline at end of file
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/CC-Praxis-Antlr X Uebersetzer-Leer.iml b/CC-Praxis-Antlr X Uebersetzer-Leer/CC-Praxis-Antlr X Uebersetzer-Leer.iml
new file mode 100644
index 0000000..fb8e866
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/CC-Praxis-Antlr X Uebersetzer-Leer.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/X.tokens b/CC-Praxis-Antlr X Uebersetzer-Leer/X.tokens
new file mode 100644
index 0000000..bdfd911
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/X.tokens
@@ -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
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/AntlrXCompiler.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/AntlrXCompiler.java
new file mode 100644
index 0000000..2f0acd7
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/AntlrXCompiler.java
@@ -0,0 +1,93 @@
+/* **********************************************
+ * Duale Hochschule Baden-Württemberg Karlsruhe
+ * Prof. Dr. Jörn Eisenbiegler
+ *
+ * Vorlesung Übersetzerbau
+ * Praxis ANTLR-Parser für X
+ * - Main-Klasse
+ *
+ * **********************************************
+ */
+
+package de.dhbw.compiler.antlrxcompiler;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+
+import org.antlr.runtime.ANTLRInputStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.tree.CommonTree;
+import org.antlr.runtime.tree.CommonTreeNodeStream;
+import org.antlr.runtime.tree.DOTTreeGenerator;
+import org.antlr.runtime.tree.Tree;
+import org.antlr.stringtemplate.StringTemplate;
+
+public class AntlrXCompiler {
+
+ public static void saveToGrapvizDOT(Tree tree, String name) throws FileNotFoundException {
+ StringTemplate dot = (new DOTTreeGenerator()).toDOT(tree);
+ PrintWriter out = new PrintWriter(name);
+ out.println(dot.toString());
+ out.close();
+ }
+
+ public static void saveToJavaFile(StringTemplate template, String name) throws FileNotFoundException {
+ PrintWriter out = new PrintWriter(name);
+ out.println(template.toString());
+ out.close();
+ }
+
+ private static final String TEST =
+ "program test2;\n"+
+ " x : int;\n"+
+ " y : float;\n"+
+ " z : string;\n"+
+ "begin\n"+
+ " x := 4+5+6.2;\n"+
+ " y := 3.56+1.2e3+45.e-67+4e34+3E-1;\n"+
+ " z := \"Hello \\\"World\\\"\" + \":\";\n"+
+ " z := \"Peter\" + 4;\n"+
+ " if 2<3 then abc := 5 else abc := 7;\n"+
+ " while (x>y) y := y+1;\n"+
+ " begin\n"+
+ " for (x:=1; x<6; x:=x+1) y:=y+2;\n"+
+ " end;\n"+
+ "end.";
+
+ private static final String TEST2 =
+ "program test2;\n"+
+ "begin\n"+
+ " x := 4-5*6*7+8/9;\n"+
+ " y := 0*x;\n"+
+ "end.";
+
+ private static final String BEISPIELFOLIEN =
+ "program test5;\n"+
+ " read x : int;\n"+
+ " print y : float;\n"+
+ " z : int;\n"+
+ "begin\n"+
+ " while (x<4) begin\n"+
+ " for (z:=0; z<4; z:=z+1) x:=x+2;\n"+
+ " if x=4 then begin\n"+
+ " x:=z*(x+2);\n"+
+ " x:=x+10;\n"+
+ " end else y:=100.e-3;\n"+
+ " end;\n"+
+ "end.\n";
+
+ public static void main(String[] args) throws Exception {
+
+ XTreeAdaptor xTreeAdaptor = new XTreeAdaptor();
+
+ ANTLRInputStream input = new ANTLRInputStream(new ByteArrayInputStream(TEST2.getBytes()));
+ XLexer lexer = new XLexer(input);
+ XParser parser = new XParser(new CommonTokenStream(lexer));
+ parser.setTreeAdaptor(xTreeAdaptor);
+ CommonTree tree = parser.program().getTree();
+
+ //TODO Weitere Stufen Aufrufen
+
+ }
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/Symbol.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/Symbol.java
new file mode 100644
index 0000000..c7db39e
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/Symbol.java
@@ -0,0 +1,31 @@
+package de.dhbw.compiler.antlrxcompiler;
+
+public class Symbol {
+
+ public String name = "";
+ public XType type = XType.NoType;
+ public boolean read = false;
+ public boolean print = false;
+ public boolean isConst = false;
+
+ public Symbol(String name, XType type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ public Symbol(String name, XType type, boolean read, boolean print) {
+ this(name, type);
+ this.read = read;
+ this.print = print;
+ }
+
+ public String toString() {
+ String res = "["+name+","+type;
+ if (read) { res+=",read"; }
+ if (print) { res+=",print"; }
+ if (isConst) { res+=",const"; }
+ res += "]";
+ return res;
+ }
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/SymbolTable.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/SymbolTable.java
new file mode 100644
index 0000000..e80365a
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/SymbolTable.java
@@ -0,0 +1,24 @@
+package de.dhbw.compiler.antlrxcompiler;
+
+import java.util.HashMap;
+
+public class SymbolTable extends HashMap{
+
+ private static final long serialVersionUID = 1L;
+
+ /* Singleton */
+ private static SymbolTable instance = new SymbolTable();
+
+ private SymbolTable() {}
+
+ public static SymbolTable getInstance() {
+ return instance;
+ }
+
+ public String toString() {
+ StringBuffer res = new StringBuffer();
+ for (Symbol s: this.values()) { res.append(s.toString()+"\n"); }
+ return res.toString();
+ }
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g
new file mode 100644
index 0000000..7aa3654
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g
@@ -0,0 +1,89 @@
+/* **********************************************
+ * 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 = XTree;
+}
+
+// AST-Tokens
+tokens {
+ DECL;
+ STATLIST;
+ DECLLIST;
+ UMINUS;
+}
+
+@parser::header {package de.dhbw.compiler.antlrxcompiler;}
+@lexer::header {package de.dhbw.compiler.antlrxcompiler;}
+
+// Ignore Whitespace
+WS: ( '\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); };
+COMMENT: '/*' .* '*/' { skip(); };
+
+// Zeichensatz
+fragment LETTER: 'a'..'z' | 'A'..'Z';
+fragment POSDIGIT: '1'..'9';
+fragment ZERO: '0';
+fragment DIGIT: '0'..'9';
+fragment OTHER: ' ' | '.' | ':' | '\\"';
+
+// Konstanten und Namen
+INTCONST: ZERO | (POSDIGIT DIGIT*);
+
+FLOATCONST: (INTCONST ('.' DIGIT*)? ('e'|'E')('+' |'-' )? INTCONST) => INTCONST ('.' DIGIT*)? ('e'|'E')('+' |'-' )? INTCONST |
+ INTCONST ('.' DIGIT*)?;
+
+STRINGCONST: '\"' (LETTER|DIGIT|OTHER)* '\"';
+
+ID: LETTER (LETTER|DIGIT)*;
+
+INVALID: .;
+
+// Deklarationen
+decl: ID ':' (type='int' | type='float' | type='string') ';' -> ^(DECL ID $type)
+ | 'read' ID ':' (type='int' | type='float' | type='string') ';' -> ^(DECL ID $type 'read')
+ | 'print' ID ':' (type='int' | type='float' | type='string') ';' -> ^(DECL ID $type 'print')
+ | 'read' 'print' ID ':' (type='int' | type='float' | type='string') ';' -> ^(DECL ID $type 'read' 'print');
+
+decllist: decl* -> ^(DECLLIST decl*);
+
+// Ausdrücke
+expr: multexpr (('+'^ | '-'^) multexpr)*;
+multexpr: simpleexpr (('*'^ | '/'^) simpleexpr)*;
+simpleexpr: '('! expr ')'!
+ | INTCONST | '-' INTCONST -> ^(UMINUS INTCONST)
+ | FLOATCONST | '-' FLOATCONST -> ^(UMINUS FLOATCONST)
+ | ID | STRINGCONST;
+
+// Zuweisung
+assignstat: ID ':='^ expr;
+
+// Bedingungen
+cond: expr ('<'^ |'>'^ |'='^ ) expr;
+
+// Bedingte Zuweisung
+condstat: 'if'^ cond 'then'! stat (options {greedy=true;}: 'else'! stat)?;
+
+// Schleifen
+whilestat: 'while' '(' cond ')' stat -> ^('while' cond stat);
+forstat: 'for'^ '('! assignstat ';'! cond ';'! assignstat ')'! stat;
+
+// Anweisungen
+stat: assignstat | condstat | whilestat | forstat | statlist;
+
+statlist: 'begin' (stat ';')* 'end' -> ^(STATLIST stat*);
+
+// Programme
+program: 'program' ID ';' decllist statlist '.' EOF -> ^('program' ID decllist statlist);
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.tokens b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.tokens
new file mode 100644
index 0000000..5e3d994
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.tokens
@@ -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
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XLexer.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XLexer.java
new file mode 100644
index 0000000..1682580
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XLexer.java
@@ -0,0 +1,2047 @@
+// $ANTLR 3.5.2 /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g 2020-06-10 10:19:34
+package de.dhbw.compiler.antlrxcompiler;
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+@SuppressWarnings("all")
+public class XLexer extends Lexer {
+ public static final int EOF=-1;
+ public static final int T__20=20;
+ public static final int T__21=21;
+ public static final int T__22=22;
+ public static final int T__23=23;
+ public static final int T__24=24;
+ public static final int T__25=25;
+ public static final int T__26=26;
+ public static final int T__27=27;
+ public static final int T__28=28;
+ public static final int T__29=29;
+ public static final int T__30=30;
+ public static final int T__31=31;
+ public static final int T__32=32;
+ public static final int T__33=33;
+ public static final int T__34=34;
+ public static final int T__35=35;
+ public static final int T__36=36;
+ public static final int T__37=37;
+ public static final int T__38=38;
+ public static final int T__39=39;
+ public static final int T__40=40;
+ public static final int T__41=41;
+ public static final int T__42=42;
+ public static final int T__43=43;
+ public static final int T__44=44;
+ public static final int T__45=45;
+ public static final int COMMENT=4;
+ public static final int DECL=5;
+ public static final int DECLLIST=6;
+ public static final int DIGIT=7;
+ public static final int FLOATCONST=8;
+ public static final int ID=9;
+ public static final int INTCONST=10;
+ public static final int INVALID=11;
+ public static final int LETTER=12;
+ public static final int OTHER=13;
+ public static final int POSDIGIT=14;
+ public static final int STATLIST=15;
+ public static final int STRINGCONST=16;
+ public static final int UMINUS=17;
+ public static final int WS=18;
+ public static final int ZERO=19;
+
+ // delegates
+ // delegators
+ public Lexer[] getDelegates() {
+ return new Lexer[] {};
+ }
+
+ public XLexer() {}
+ public XLexer(CharStream input) {
+ this(input, new RecognizerSharedState());
+ }
+ public XLexer(CharStream input, RecognizerSharedState state) {
+ super(input,state);
+ }
+ @Override public String getGrammarFileName() { return "/Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g"; }
+
+ // $ANTLR start "T__20"
+ public final void mT__20() throws RecognitionException {
+ try {
+ int _type = T__20;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:9:7: ( '(' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:9:9: '('
+ {
+ match('('); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__20"
+
+ // $ANTLR start "T__21"
+ public final void mT__21() throws RecognitionException {
+ try {
+ int _type = T__21;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:10:7: ( ')' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:10:9: ')'
+ {
+ match(')'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__21"
+
+ // $ANTLR start "T__22"
+ public final void mT__22() throws RecognitionException {
+ try {
+ int _type = T__22;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:11:7: ( '*' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:11:9: '*'
+ {
+ match('*'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__22"
+
+ // $ANTLR start "T__23"
+ public final void mT__23() throws RecognitionException {
+ try {
+ int _type = T__23;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:12:7: ( '+' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:12:9: '+'
+ {
+ match('+'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__23"
+
+ // $ANTLR start "T__24"
+ public final void mT__24() throws RecognitionException {
+ try {
+ int _type = T__24;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:13:7: ( '-' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:13:9: '-'
+ {
+ match('-'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__24"
+
+ // $ANTLR start "T__25"
+ public final void mT__25() throws RecognitionException {
+ try {
+ int _type = T__25;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:14:7: ( '.' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:14:9: '.'
+ {
+ match('.'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__25"
+
+ // $ANTLR start "T__26"
+ public final void mT__26() throws RecognitionException {
+ try {
+ int _type = T__26;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:15:7: ( '/' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:15:9: '/'
+ {
+ match('/'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__26"
+
+ // $ANTLR start "T__27"
+ public final void mT__27() throws RecognitionException {
+ try {
+ int _type = T__27;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:16:7: ( ':' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:16:9: ':'
+ {
+ match(':'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__27"
+
+ // $ANTLR start "T__28"
+ public final void mT__28() throws RecognitionException {
+ try {
+ int _type = T__28;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:17:7: ( ':=' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:17:9: ':='
+ {
+ match(":="); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__28"
+
+ // $ANTLR start "T__29"
+ public final void mT__29() throws RecognitionException {
+ try {
+ int _type = T__29;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:18:7: ( ';' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:18:9: ';'
+ {
+ match(';'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__29"
+
+ // $ANTLR start "T__30"
+ public final void mT__30() throws RecognitionException {
+ try {
+ int _type = T__30;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:19:7: ( '<' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:19:9: '<'
+ {
+ match('<'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__30"
+
+ // $ANTLR start "T__31"
+ public final void mT__31() throws RecognitionException {
+ try {
+ int _type = T__31;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:20:7: ( '=' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:20:9: '='
+ {
+ match('='); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__31"
+
+ // $ANTLR start "T__32"
+ public final void mT__32() throws RecognitionException {
+ try {
+ int _type = T__32;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:21:7: ( '>' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:21:9: '>'
+ {
+ match('>'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__32"
+
+ // $ANTLR start "T__33"
+ public final void mT__33() throws RecognitionException {
+ try {
+ int _type = T__33;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:22:7: ( 'begin' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:22:9: 'begin'
+ {
+ match("begin"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__33"
+
+ // $ANTLR start "T__34"
+ public final void mT__34() throws RecognitionException {
+ try {
+ int _type = T__34;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:23:7: ( 'else' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:23:9: 'else'
+ {
+ match("else"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__34"
+
+ // $ANTLR start "T__35"
+ public final void mT__35() throws RecognitionException {
+ try {
+ int _type = T__35;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:24:7: ( 'end' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:24:9: 'end'
+ {
+ match("end"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__35"
+
+ // $ANTLR start "T__36"
+ public final void mT__36() throws RecognitionException {
+ try {
+ int _type = T__36;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:25:7: ( 'float' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:25:9: 'float'
+ {
+ match("float"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__36"
+
+ // $ANTLR start "T__37"
+ public final void mT__37() throws RecognitionException {
+ try {
+ int _type = T__37;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:26:7: ( 'for' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:26:9: 'for'
+ {
+ match("for"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__37"
+
+ // $ANTLR start "T__38"
+ public final void mT__38() throws RecognitionException {
+ try {
+ int _type = T__38;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:27:7: ( 'if' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:27:9: 'if'
+ {
+ match("if"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__38"
+
+ // $ANTLR start "T__39"
+ public final void mT__39() throws RecognitionException {
+ try {
+ int _type = T__39;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:28:7: ( 'int' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:28:9: 'int'
+ {
+ match("int"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__39"
+
+ // $ANTLR start "T__40"
+ public final void mT__40() throws RecognitionException {
+ try {
+ int _type = T__40;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:29:7: ( 'print' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:29:9: 'print'
+ {
+ match("print"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__40"
+
+ // $ANTLR start "T__41"
+ public final void mT__41() throws RecognitionException {
+ try {
+ int _type = T__41;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:30:7: ( 'program' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:30:9: 'program'
+ {
+ match("program"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__41"
+
+ // $ANTLR start "T__42"
+ public final void mT__42() throws RecognitionException {
+ try {
+ int _type = T__42;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:31:7: ( 'read' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:31:9: 'read'
+ {
+ match("read"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__42"
+
+ // $ANTLR start "T__43"
+ public final void mT__43() throws RecognitionException {
+ try {
+ int _type = T__43;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:32:7: ( 'string' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:32:9: 'string'
+ {
+ match("string"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__43"
+
+ // $ANTLR start "T__44"
+ public final void mT__44() throws RecognitionException {
+ try {
+ int _type = T__44;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:33:7: ( 'then' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:33:9: 'then'
+ {
+ match("then"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__44"
+
+ // $ANTLR start "T__45"
+ public final void mT__45() throws RecognitionException {
+ try {
+ int _type = T__45;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:34:7: ( 'while' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:34:9: 'while'
+ {
+ match("while"); if (state.failed) return;
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__45"
+
+ // $ANTLR start "WS"
+ public final void mWS() throws RecognitionException {
+ try {
+ int _type = WS;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:32:3: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:32:9: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:32:9: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+
+ int cnt1=0;
+ loop1:
+ while (true) {
+ int alt1=2;
+ int LA1_0 = input.LA(1);
+ if ( ((LA1_0 >= '\t' && LA1_0 <= '\n')||(LA1_0 >= '\f' && LA1_0 <= '\r')||LA1_0==' ') ) {
+ alt1=1;
+ }
+
+ switch (alt1) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( (input.LA(1) >= '\t' && input.LA(1) <= '\n')||(input.LA(1) >= '\f' && input.LA(1) <= '\r')||input.LA(1)==' ' ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ if ( cnt1 >= 1 ) break loop1;
+ if (state.backtracking>0) {state.failed=true; return;}
+ EarlyExitException eee = new EarlyExitException(1, input);
+ throw eee;
+ }
+ cnt1++;
+ }
+
+ if ( state.backtracking==0 ) { skip(); }
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "WS"
+
+ // $ANTLR start "COMMENT"
+ public final void mCOMMENT() throws RecognitionException {
+ try {
+ int _type = COMMENT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:33:8: ( '/*' ( . )* '*/' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:33:10: '/*' ( . )* '*/'
+ {
+ match("/*"); if (state.failed) return;
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:33:15: ( . )*
+ loop2:
+ while (true) {
+ int alt2=2;
+ int LA2_0 = input.LA(1);
+ if ( (LA2_0=='*') ) {
+ int LA2_1 = input.LA(2);
+ if ( (LA2_1=='/') ) {
+ alt2=2;
+ }
+ else if ( ((LA2_1 >= '\u0000' && LA2_1 <= '.')||(LA2_1 >= '0' && LA2_1 <= '\uFFFF')) ) {
+ alt2=1;
+ }
+
+ }
+ else if ( ((LA2_0 >= '\u0000' && LA2_0 <= ')')||(LA2_0 >= '+' && LA2_0 <= '\uFFFF')) ) {
+ alt2=1;
+ }
+
+ switch (alt2) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:33:15: .
+ {
+ matchAny(); if (state.failed) return;
+ }
+ break;
+
+ default :
+ break loop2;
+ }
+ }
+
+ match("*/"); if (state.failed) return;
+
+ if ( state.backtracking==0 ) { skip(); }
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "COMMENT"
+
+ // $ANTLR start "LETTER"
+ public final void mLETTER() throws RecognitionException {
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:36:16: ( 'a' .. 'z' | 'A' .. 'Z' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z')||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "LETTER"
+
+ // $ANTLR start "POSDIGIT"
+ public final void mPOSDIGIT() throws RecognitionException {
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:37:18: ( '1' .. '9' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( (input.LA(1) >= '1' && input.LA(1) <= '9') ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "POSDIGIT"
+
+ // $ANTLR start "ZERO"
+ public final void mZERO() throws RecognitionException {
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:38:14: ( '0' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:38:20: '0'
+ {
+ match('0'); if (state.failed) return;
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ZERO"
+
+ // $ANTLR start "DIGIT"
+ public final void mDIGIT() throws RecognitionException {
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:39:15: ( '0' .. '9' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "DIGIT"
+
+ // $ANTLR start "OTHER"
+ public final void mOTHER() throws RecognitionException {
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:40:15: ( ' ' | '.' | ':' | '\\\\\"' )
+ int alt3=4;
+ switch ( input.LA(1) ) {
+ case ' ':
+ {
+ alt3=1;
+ }
+ break;
+ case '.':
+ {
+ alt3=2;
+ }
+ break;
+ case ':':
+ {
+ alt3=3;
+ }
+ break;
+ case '\\':
+ {
+ alt3=4;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 3, 0, input);
+ throw nvae;
+ }
+ switch (alt3) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:40:20: ' '
+ {
+ match(' '); if (state.failed) return;
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:40:26: '.'
+ {
+ match('.'); if (state.failed) return;
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:40:32: ':'
+ {
+ match(':'); if (state.failed) return;
+ }
+ break;
+ case 4 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:40:38: '\\\\\"'
+ {
+ match("\\\""); if (state.failed) return;
+
+ }
+ break;
+
+ }
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "OTHER"
+
+ // $ANTLR start "INTCONST"
+ public final void mINTCONST() throws RecognitionException {
+ try {
+ int _type = INTCONST;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:43:9: ( ZERO | ( POSDIGIT ( DIGIT )* ) )
+ int alt5=2;
+ int LA5_0 = input.LA(1);
+ if ( (LA5_0=='0') ) {
+ alt5=1;
+ }
+ else if ( ((LA5_0 >= '1' && LA5_0 <= '9')) ) {
+ alt5=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 5, 0, input);
+ throw nvae;
+ }
+
+ switch (alt5) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:43:11: ZERO
+ {
+ mZERO(); if (state.failed) return;
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:43:18: ( POSDIGIT ( DIGIT )* )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:43:18: ( POSDIGIT ( DIGIT )* )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:43:19: POSDIGIT ( DIGIT )*
+ {
+ mPOSDIGIT(); if (state.failed) return;
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:43:28: ( DIGIT )*
+ loop4:
+ while (true) {
+ int alt4=2;
+ int LA4_0 = input.LA(1);
+ if ( ((LA4_0 >= '0' && LA4_0 <= '9')) ) {
+ alt4=1;
+ }
+
+ switch (alt4) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ break loop4;
+ }
+ }
+
+ }
+
+ }
+ break;
+
+ }
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "INTCONST"
+
+ // $ANTLR start "FLOATCONST"
+ public final void mFLOATCONST() throws RecognitionException {
+ try {
+ int _type = FLOATCONST;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:11: ( ( INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST )=> INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST | INTCONST ( '.' ( DIGIT )* )? )
+ int alt11=2;
+ alt11 = dfa11.predict(input);
+ switch (alt11) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:16: ( INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST )=> INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST
+ {
+ mINTCONST(); if (state.failed) return;
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:84: ( '.' ( DIGIT )* )?
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+ if ( (LA7_0=='.') ) {
+ alt7=1;
+ }
+ switch (alt7) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:85: '.' ( DIGIT )*
+ {
+ match('.'); if (state.failed) return;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:89: ( DIGIT )*
+ loop6:
+ while (true) {
+ int alt6=2;
+ int LA6_0 = input.LA(1);
+ if ( ((LA6_0 >= '0' && LA6_0 <= '9')) ) {
+ alt6=1;
+ }
+
+ switch (alt6) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ break loop6;
+ }
+ }
+
+ }
+ break;
+
+ }
+
+ if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:107: ( '+' | '-' )?
+ int alt8=2;
+ int LA8_0 = input.LA(1);
+ if ( (LA8_0=='+'||LA8_0=='-') ) {
+ alt8=1;
+ }
+ switch (alt8) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ }
+
+ mINTCONST(); if (state.failed) return;
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:46:16: INTCONST ( '.' ( DIGIT )* )?
+ {
+ mINTCONST(); if (state.failed) return;
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:46:25: ( '.' ( DIGIT )* )?
+ int alt10=2;
+ int LA10_0 = input.LA(1);
+ if ( (LA10_0=='.') ) {
+ alt10=1;
+ }
+ switch (alt10) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:46:26: '.' ( DIGIT )*
+ {
+ match('.'); if (state.failed) return;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:46:30: ( DIGIT )*
+ loop9:
+ while (true) {
+ int alt9=2;
+ int LA9_0 = input.LA(1);
+ if ( ((LA9_0 >= '0' && LA9_0 <= '9')) ) {
+ alt9=1;
+ }
+
+ switch (alt9) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ break loop9;
+ }
+ }
+
+ }
+ break;
+
+ }
+
+ }
+ break;
+
+ }
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "FLOATCONST"
+
+ // $ANTLR start "STRINGCONST"
+ public final void mSTRINGCONST() throws RecognitionException {
+ try {
+ int _type = STRINGCONST;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:48:12: ( '\\\"' ( LETTER | DIGIT | OTHER )* '\\\"' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:48:16: '\\\"' ( LETTER | DIGIT | OTHER )* '\\\"'
+ {
+ match('\"'); if (state.failed) return;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:48:21: ( LETTER | DIGIT | OTHER )*
+ loop12:
+ while (true) {
+ int alt12=4;
+ switch ( input.LA(1) ) {
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ case 'G':
+ case 'H':
+ case 'I':
+ case 'J':
+ case 'K':
+ case 'L':
+ case 'M':
+ case 'N':
+ case 'O':
+ case 'P':
+ case 'Q':
+ case 'R':
+ case 'S':
+ case 'T':
+ case 'U':
+ case 'V':
+ case 'W':
+ case 'X':
+ case 'Y':
+ case 'Z':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'h':
+ case 'i':
+ case 'j':
+ case 'k':
+ case 'l':
+ case 'm':
+ case 'n':
+ case 'o':
+ case 'p':
+ case 'q':
+ case 'r':
+ case 's':
+ case 't':
+ case 'u':
+ case 'v':
+ case 'w':
+ case 'x':
+ case 'y':
+ case 'z':
+ {
+ alt12=1;
+ }
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ alt12=2;
+ }
+ break;
+ case ' ':
+ case '.':
+ case ':':
+ case '\\':
+ {
+ alt12=3;
+ }
+ break;
+ }
+ switch (alt12) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:48:22: LETTER
+ {
+ mLETTER(); if (state.failed) return;
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:48:29: DIGIT
+ {
+ mDIGIT(); if (state.failed) return;
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:48:35: OTHER
+ {
+ mOTHER(); if (state.failed) return;
+
+ }
+ break;
+
+ default :
+ break loop12;
+ }
+ }
+
+ match('\"'); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "STRINGCONST"
+
+ // $ANTLR start "ID"
+ public final void mID() throws RecognitionException {
+ try {
+ int _type = ID;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:50:3: ( LETTER ( LETTER | DIGIT )* )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:50:11: LETTER ( LETTER | DIGIT )*
+ {
+ mLETTER(); if (state.failed) return;
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:50:18: ( LETTER | DIGIT )*
+ loop13:
+ while (true) {
+ int alt13=2;
+ int LA13_0 = input.LA(1);
+ if ( ((LA13_0 >= '0' && LA13_0 <= '9')||(LA13_0 >= 'A' && LA13_0 <= 'Z')||(LA13_0 >= 'a' && LA13_0 <= 'z')) ) {
+ alt13=1;
+ }
+
+ switch (alt13) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'Z')||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ break loop13;
+ }
+ }
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ID"
+
+ // $ANTLR start "INVALID"
+ public final void mINVALID() throws RecognitionException {
+ try {
+ int _type = INVALID;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:52:8: ( . )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:52:11: .
+ {
+ matchAny(); if (state.failed) return;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "INVALID"
+
+ @Override
+ public void mTokens() throws RecognitionException {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:8: ( T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | WS | COMMENT | INTCONST | FLOATCONST | STRINGCONST | ID | INVALID )
+ int alt14=33;
+ alt14 = dfa14.predict(input);
+ switch (alt14) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:10: T__20
+ {
+ mT__20(); if (state.failed) return;
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:16: T__21
+ {
+ mT__21(); if (state.failed) return;
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:22: T__22
+ {
+ mT__22(); if (state.failed) return;
+
+ }
+ break;
+ case 4 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:28: T__23
+ {
+ mT__23(); if (state.failed) return;
+
+ }
+ break;
+ case 5 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:34: T__24
+ {
+ mT__24(); if (state.failed) return;
+
+ }
+ break;
+ case 6 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:40: T__25
+ {
+ mT__25(); if (state.failed) return;
+
+ }
+ break;
+ case 7 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:46: T__26
+ {
+ mT__26(); if (state.failed) return;
+
+ }
+ break;
+ case 8 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:52: T__27
+ {
+ mT__27(); if (state.failed) return;
+
+ }
+ break;
+ case 9 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:58: T__28
+ {
+ mT__28(); if (state.failed) return;
+
+ }
+ break;
+ case 10 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:64: T__29
+ {
+ mT__29(); if (state.failed) return;
+
+ }
+ break;
+ case 11 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:70: T__30
+ {
+ mT__30(); if (state.failed) return;
+
+ }
+ break;
+ case 12 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:76: T__31
+ {
+ mT__31(); if (state.failed) return;
+
+ }
+ break;
+ case 13 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:82: T__32
+ {
+ mT__32(); if (state.failed) return;
+
+ }
+ break;
+ case 14 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:88: T__33
+ {
+ mT__33(); if (state.failed) return;
+
+ }
+ break;
+ case 15 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:94: T__34
+ {
+ mT__34(); if (state.failed) return;
+
+ }
+ break;
+ case 16 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:100: T__35
+ {
+ mT__35(); if (state.failed) return;
+
+ }
+ break;
+ case 17 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:106: T__36
+ {
+ mT__36(); if (state.failed) return;
+
+ }
+ break;
+ case 18 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:112: T__37
+ {
+ mT__37(); if (state.failed) return;
+
+ }
+ break;
+ case 19 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:118: T__38
+ {
+ mT__38(); if (state.failed) return;
+
+ }
+ break;
+ case 20 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:124: T__39
+ {
+ mT__39(); if (state.failed) return;
+
+ }
+ break;
+ case 21 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:130: T__40
+ {
+ mT__40(); if (state.failed) return;
+
+ }
+ break;
+ case 22 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:136: T__41
+ {
+ mT__41(); if (state.failed) return;
+
+ }
+ break;
+ case 23 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:142: T__42
+ {
+ mT__42(); if (state.failed) return;
+
+ }
+ break;
+ case 24 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:148: T__43
+ {
+ mT__43(); if (state.failed) return;
+
+ }
+ break;
+ case 25 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:154: T__44
+ {
+ mT__44(); if (state.failed) return;
+
+ }
+ break;
+ case 26 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:160: T__45
+ {
+ mT__45(); if (state.failed) return;
+
+ }
+ break;
+ case 27 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:166: WS
+ {
+ mWS(); if (state.failed) return;
+
+ }
+ break;
+ case 28 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:169: COMMENT
+ {
+ mCOMMENT(); if (state.failed) return;
+
+ }
+ break;
+ case 29 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:177: INTCONST
+ {
+ mINTCONST(); if (state.failed) return;
+
+ }
+ break;
+ case 30 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:186: FLOATCONST
+ {
+ mFLOATCONST(); if (state.failed) return;
+
+ }
+ break;
+ case 31 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:197: STRINGCONST
+ {
+ mSTRINGCONST(); if (state.failed) return;
+
+ }
+ break;
+ case 32 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:209: ID
+ {
+ mID(); if (state.failed) return;
+
+ }
+ break;
+ case 33 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:1:212: INVALID
+ {
+ mINVALID(); if (state.failed) return;
+
+ }
+ break;
+
+ }
+ }
+
+ // $ANTLR start synpred1_X
+ public final void synpred1_X_fragment() throws RecognitionException {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:16: ( INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:17: INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST
+ {
+ mINTCONST(); if (state.failed) return;
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:26: ( '.' ( DIGIT )* )?
+ int alt16=2;
+ int LA16_0 = input.LA(1);
+ if ( (LA16_0=='.') ) {
+ alt16=1;
+ }
+ switch (alt16) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:27: '.' ( DIGIT )*
+ {
+ match('.'); if (state.failed) return;
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:31: ( DIGIT )*
+ loop15:
+ while (true) {
+ int alt15=2;
+ int LA15_0 = input.LA(1);
+ if ( ((LA15_0 >= '0' && LA15_0 <= '9')) ) {
+ alt15=1;
+ }
+
+ switch (alt15) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ break loop15;
+ }
+ }
+
+ }
+ break;
+
+ }
+
+ if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:45:49: ( '+' | '-' )?
+ int alt17=2;
+ int LA17_0 = input.LA(1);
+ if ( (LA17_0=='+'||LA17_0=='-') ) {
+ alt17=1;
+ }
+ switch (alt17) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:
+ {
+ if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
+ input.consume();
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ }
+
+ mINTCONST(); if (state.failed) return;
+
+ }
+
+ }
+ // $ANTLR end synpred1_X
+
+ public final boolean synpred1_X() {
+ state.backtracking++;
+ int start = input.mark();
+ try {
+ synpred1_X_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !state.failed;
+ input.rewind(start);
+ state.backtracking--;
+ state.failed=false;
+ return success;
+ }
+
+
+ protected DFA11 dfa11 = new DFA11(this);
+ protected DFA14 dfa14 = new DFA14(this);
+ static final String DFA11_eotS =
+ "\1\uffff\2\3\1\uffff\1\3\1\uffff\2\3";
+ static final String DFA11_eofS =
+ "\10\uffff";
+ static final String DFA11_minS =
+ "\1\60\2\56\1\uffff\1\60\1\uffff\1\56\1\60";
+ static final String DFA11_maxS =
+ "\1\71\2\145\1\uffff\1\145\1\uffff\2\145";
+ static final String DFA11_acceptS =
+ "\3\uffff\1\2\1\uffff\1\1\2\uffff";
+ static final String DFA11_specialS =
+ "\1\uffff\1\4\1\2\1\uffff\1\0\1\uffff\1\1\1\3}>";
+ static final String[] DFA11_transitionS = {
+ "\1\1\11\2",
+ "\1\4\26\uffff\1\5\37\uffff\1\5",
+ "\1\4\1\uffff\12\6\13\uffff\1\5\37\uffff\1\5",
+ "",
+ "\12\7\13\uffff\1\5\37\uffff\1\5",
+ "",
+ "\1\4\1\uffff\12\6\13\uffff\1\5\37\uffff\1\5",
+ "\12\7\13\uffff\1\5\37\uffff\1\5"
+ };
+
+ static final short[] DFA11_eot = DFA.unpackEncodedString(DFA11_eotS);
+ static final short[] DFA11_eof = DFA.unpackEncodedString(DFA11_eofS);
+ static final char[] DFA11_min = DFA.unpackEncodedStringToUnsignedChars(DFA11_minS);
+ static final char[] DFA11_max = DFA.unpackEncodedStringToUnsignedChars(DFA11_maxS);
+ static final short[] DFA11_accept = DFA.unpackEncodedString(DFA11_acceptS);
+ static final short[] DFA11_special = DFA.unpackEncodedString(DFA11_specialS);
+ static final short[][] DFA11_transition;
+
+ static {
+ int numStates = DFA11_transitionS.length;
+ DFA11_transition = new short[numStates][];
+ for (int i=0; i INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST | INTCONST ( '.' ( DIGIT )* )? );";
+ }
+ @Override
+ public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
+ IntStream input = _input;
+ int _s = s;
+ switch ( s ) {
+ case 0 :
+ int LA11_4 = input.LA(1);
+
+ int index11_4 = input.index();
+ input.rewind();
+ s = -1;
+ if ( ((LA11_4 >= '0' && LA11_4 <= '9')) ) {s = 7;}
+ else if ( (LA11_4=='E'||LA11_4=='e') && (synpred1_X())) {s = 5;}
+ else s = 3;
+
+ input.seek(index11_4);
+ if ( s>=0 ) return s;
+ break;
+
+ case 1 :
+ int LA11_6 = input.LA(1);
+
+ int index11_6 = input.index();
+ input.rewind();
+ s = -1;
+ if ( (LA11_6=='.') ) {s = 4;}
+ else if ( (LA11_6=='E'||LA11_6=='e') && (synpred1_X())) {s = 5;}
+ else if ( ((LA11_6 >= '0' && LA11_6 <= '9')) ) {s = 6;}
+ else s = 3;
+
+ input.seek(index11_6);
+ if ( s>=0 ) return s;
+ break;
+
+ case 2 :
+ int LA11_2 = input.LA(1);
+
+ int index11_2 = input.index();
+ input.rewind();
+ s = -1;
+ if ( ((LA11_2 >= '0' && LA11_2 <= '9')) ) {s = 6;}
+ else if ( (LA11_2=='.') ) {s = 4;}
+ else if ( (LA11_2=='E'||LA11_2=='e') && (synpred1_X())) {s = 5;}
+ else s = 3;
+
+ input.seek(index11_2);
+ if ( s>=0 ) return s;
+ break;
+
+ case 3 :
+ int LA11_7 = input.LA(1);
+
+ int index11_7 = input.index();
+ input.rewind();
+ s = -1;
+ if ( (LA11_7=='E'||LA11_7=='e') && (synpred1_X())) {s = 5;}
+ else if ( ((LA11_7 >= '0' && LA11_7 <= '9')) ) {s = 7;}
+ else s = 3;
+
+ input.seek(index11_7);
+ if ( s>=0 ) return s;
+ break;
+
+ case 4 :
+ int LA11_1 = input.LA(1);
+
+ int index11_1 = input.index();
+ input.rewind();
+ s = -1;
+ if ( (LA11_1=='.') ) {s = 4;}
+ else if ( (LA11_1=='E'||LA11_1=='e') && (synpred1_X())) {s = 5;}
+ else s = 3;
+
+ input.seek(index11_1);
+ if ( s>=0 ) return s;
+ break;
+ }
+ if (state.backtracking>0) {state.failed=true; return -1;}
+ NoViableAltException nvae =
+ new NoViableAltException(getDescription(), 11, _s, input);
+ error(nvae);
+ throw nvae;
+ }
+ }
+
+ static final String DFA14_eotS =
+ "\7\uffff\1\43\1\45\4\uffff\11\53\1\uffff\2\70\1\33\20\uffff\1\53\1\uffff"+
+ "\4\53\1\101\6\53\3\uffff\1\70\1\uffff\2\53\1\113\1\53\1\115\1\uffff\1"+
+ "\116\7\53\1\126\1\uffff\1\53\2\uffff\2\53\1\132\1\53\1\134\1\53\1\136"+
+ "\1\uffff\1\137\1\140\1\53\1\uffff\1\53\1\uffff\1\143\3\uffff\1\53\1\145"+
+ "\1\uffff\1\146\2\uffff";
+ static final String DFA14_eofS =
+ "\147\uffff";
+ static final String DFA14_minS =
+ "\1\0\6\uffff\1\52\1\75\4\uffff\1\145\2\154\1\146\1\162\1\145\1\164\2\150"+
+ "\1\uffff\2\56\1\40\20\uffff\1\147\1\uffff\1\163\1\144\1\157\1\162\1\60"+
+ "\1\164\1\151\1\141\1\162\1\145\1\151\3\uffff\1\56\1\uffff\1\151\1\145"+
+ "\1\60\1\141\1\60\1\uffff\1\60\1\156\1\147\1\144\1\151\1\156\1\154\1\156"+
+ "\1\60\1\uffff\1\164\2\uffff\1\164\1\162\1\60\1\156\1\60\1\145\1\60\1\uffff"+
+ "\2\60\1\141\1\uffff\1\147\1\uffff\1\60\3\uffff\1\155\1\60\1\uffff\1\60"+
+ "\2\uffff";
+ static final String DFA14_maxS =
+ "\1\uffff\6\uffff\1\52\1\75\4\uffff\1\145\1\156\1\157\1\156\1\162\1\145"+
+ "\1\164\2\150\1\uffff\2\145\1\172\20\uffff\1\147\1\uffff\1\163\1\144\1"+
+ "\157\1\162\1\172\1\164\1\157\1\141\1\162\1\145\1\151\3\uffff\1\145\1\uffff"+
+ "\1\151\1\145\1\172\1\141\1\172\1\uffff\1\172\1\156\1\147\1\144\1\151\1"+
+ "\156\1\154\1\156\1\172\1\uffff\1\164\2\uffff\1\164\1\162\1\172\1\156\1"+
+ "\172\1\145\1\172\1\uffff\2\172\1\141\1\uffff\1\147\1\uffff\1\172\3\uffff"+
+ "\1\155\1\172\1\uffff\1\172\2\uffff";
+ static final String DFA14_acceptS =
+ "\1\uffff\1\1\1\2\1\3\1\4\1\5\1\6\2\uffff\1\12\1\13\1\14\1\15\11\uffff"+
+ "\1\33\3\uffff\1\40\1\41\1\1\1\2\1\3\1\4\1\5\1\6\1\34\1\7\1\11\1\10\1\12"+
+ "\1\13\1\14\1\15\1\uffff\1\40\13\uffff\1\33\1\35\1\36\1\uffff\1\37\5\uffff"+
+ "\1\23\11\uffff\1\20\1\uffff\1\22\1\24\7\uffff\1\17\3\uffff\1\27\1\uffff"+
+ "\1\31\1\uffff\1\16\1\21\1\25\2\uffff\1\32\1\uffff\1\30\1\26";
+ static final String DFA14_specialS =
+ "\1\0\146\uffff}>";
+ static final String[] DFA14_transitionS = {
+ "\11\33\2\26\1\33\2\26\22\33\1\26\1\33\1\31\5\33\1\1\1\2\1\3\1\4\1\33"+
+ "\1\5\1\6\1\7\1\27\11\30\1\10\1\11\1\12\1\13\1\14\2\33\32\32\6\33\1\32"+
+ "\1\15\2\32\1\16\1\17\2\32\1\20\6\32\1\21\1\32\1\22\1\23\1\24\2\32\1\25"+
+ "\3\32\uff85\33",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "\1\42",
+ "\1\44",
+ "",
+ "",
+ "",
+ "",
+ "\1\52",
+ "\1\54\1\uffff\1\55",
+ "\1\56\2\uffff\1\57",
+ "\1\60\7\uffff\1\61",
+ "\1\62",
+ "\1\63",
+ "\1\64",
+ "\1\65",
+ "\1\66",
+ "",
+ "\1\71\26\uffff\1\71\37\uffff\1\71",
+ "\1\71\1\uffff\12\72\13\uffff\1\71\37\uffff\1\71",
+ "\1\73\1\uffff\1\73\13\uffff\1\73\1\uffff\13\73\6\uffff\32\73\1\uffff"+
+ "\1\73\4\uffff\32\73",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "\1\74",
+ "",
+ "\1\75",
+ "\1\76",
+ "\1\77",
+ "\1\100",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "\1\102",
+ "\1\103\5\uffff\1\104",
+ "\1\105",
+ "\1\106",
+ "\1\107",
+ "\1\110",
+ "",
+ "",
+ "",
+ "\1\71\1\uffff\12\72\13\uffff\1\71\37\uffff\1\71",
+ "",
+ "\1\111",
+ "\1\112",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "\1\114",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "\1\117",
+ "\1\120",
+ "\1\121",
+ "\1\122",
+ "\1\123",
+ "\1\124",
+ "\1\125",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "",
+ "\1\127",
+ "",
+ "",
+ "\1\130",
+ "\1\131",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "\1\133",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "\1\135",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "\1\141",
+ "",
+ "\1\142",
+ "",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "",
+ "",
+ "",
+ "\1\144",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "",
+ "\12\53\7\uffff\32\53\6\uffff\32\53",
+ "",
+ ""
+ };
+
+ static final short[] DFA14_eot = DFA.unpackEncodedString(DFA14_eotS);
+ static final short[] DFA14_eof = DFA.unpackEncodedString(DFA14_eofS);
+ static final char[] DFA14_min = DFA.unpackEncodedStringToUnsignedChars(DFA14_minS);
+ static final char[] DFA14_max = DFA.unpackEncodedStringToUnsignedChars(DFA14_maxS);
+ static final short[] DFA14_accept = DFA.unpackEncodedString(DFA14_acceptS);
+ static final short[] DFA14_special = DFA.unpackEncodedString(DFA14_specialS);
+ static final short[][] DFA14_transition;
+
+ static {
+ int numStates = DFA14_transitionS.length;
+ DFA14_transition = new short[numStates][];
+ for (int i=0; i') ) {s = 12;}
+ else if ( (LA14_0=='b') ) {s = 13;}
+ else if ( (LA14_0=='e') ) {s = 14;}
+ else if ( (LA14_0=='f') ) {s = 15;}
+ else if ( (LA14_0=='i') ) {s = 16;}
+ else if ( (LA14_0=='p') ) {s = 17;}
+ else if ( (LA14_0=='r') ) {s = 18;}
+ else if ( (LA14_0=='s') ) {s = 19;}
+ else if ( (LA14_0=='t') ) {s = 20;}
+ else if ( (LA14_0=='w') ) {s = 21;}
+ else if ( ((LA14_0 >= '\t' && LA14_0 <= '\n')||(LA14_0 >= '\f' && LA14_0 <= '\r')||LA14_0==' ') ) {s = 22;}
+ else if ( (LA14_0=='0') ) {s = 23;}
+ else if ( ((LA14_0 >= '1' && LA14_0 <= '9')) ) {s = 24;}
+ else if ( (LA14_0=='\"') ) {s = 25;}
+ else if ( ((LA14_0 >= 'A' && LA14_0 <= 'Z')||LA14_0=='a'||(LA14_0 >= 'c' && LA14_0 <= 'd')||(LA14_0 >= 'g' && LA14_0 <= 'h')||(LA14_0 >= 'j' && LA14_0 <= 'o')||LA14_0=='q'||(LA14_0 >= 'u' && LA14_0 <= 'v')||(LA14_0 >= 'x' && LA14_0 <= 'z')) ) {s = 26;}
+ else if ( ((LA14_0 >= '\u0000' && LA14_0 <= '\b')||LA14_0=='\u000B'||(LA14_0 >= '\u000E' && LA14_0 <= '\u001F')||LA14_0=='!'||(LA14_0 >= '#' && LA14_0 <= '\'')||LA14_0==','||(LA14_0 >= '?' && LA14_0 <= '@')||(LA14_0 >= '[' && LA14_0 <= '`')||(LA14_0 >= '{' && LA14_0 <= '\uFFFF')) ) {s = 27;}
+ if ( s>=0 ) return s;
+ break;
+ }
+ if (state.backtracking>0) {state.failed=true; return -1;}
+ NoViableAltException nvae =
+ new NoViableAltException(getDescription(), 14, _s, input);
+ error(nvae);
+ throw nvae;
+ }
+ }
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XOptimizer.g b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XOptimizer.g
new file mode 100644
index 0000000..e5784be
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XOptimizer.g
@@ -0,0 +1,63 @@
+tree grammar XOptimizer;
+
+options {
+ language = Java;
+ output = AST;
+ tokenVocab = XTypeCheck;
+ ASTLabelType = XTree;
+ filter=true;
+}
+
+
+
+@header {
+ package de.dhbw.compiler.antlrxcompiler;
+}
+
+@members {
+ private String addString(String first, String last) {
+ return first.substring(0, first.length()-1)+last.substring(1);
+ }
+
+ private String opInt(String first, String last, char op) {
+ int firstValue = 0;
+ int lastValue = 0;
+ try {
+ firstValue = Integer.parseInt(first);
+ lastValue = Integer.parseInt(last);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ switch (op) {
+ case '+': return Integer.toString(firstValue+lastValue);
+ case '-': return Integer.toString(firstValue-lastValue);
+ case '*': return Integer.toString(firstValue*lastValue);
+ case '/': return Integer.toString(firstValue/lastValue);
+ default: return "";
+ }
+ }
+
+ private String opFloat(String first, String last, char op) {
+ double firstValue = 0.0;
+ double lastValue = 0.0;
+ try {
+ firstValue = Double.parseDouble(first);
+ lastValue = Double.parseDouble(last);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ switch (op) {
+ case '+': return Double.toString(firstValue+lastValue);
+ case '-': return Double.toString(firstValue-lastValue);
+ case '*': return Double.toString(firstValue*lastValue);
+ case '/': return Double.toString(firstValue/lastValue);
+ default: return "";
+ }
+ }
+
+ }
+
+
+bottomup: ;
+
+
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XOptimizer.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XOptimizer.java
new file mode 100644
index 0000000..343cc0d
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XOptimizer.java
@@ -0,0 +1,185 @@
+// $ANTLR 3.5.2 C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XOptimizer.g 2019-05-23 12:03:27
+
+ package de.dhbw.compiler.antlrxcompiler;
+
+
+import org.antlr.runtime.*;
+import org.antlr.runtime.tree.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+
+@SuppressWarnings("all")
+public class XOptimizer extends TreeRewriter {
+ public static final String[] tokenNames = new String[] {
+ "", "", "", "", "COMMENT", "DECL", "DECLLIST",
+ "DIGIT", "FLOATCONST", "ID", "INTCONST", "INVALID", "LETTER", "OTHER",
+ "POSDIGIT", "STATLIST", "STRINGCONST", "UMINUS", "WS", "ZERO", "'('",
+ "')'", "'*'", "'+'", "'-'", "'.'", "'/'", "':'", "':='", "';'", "'<'",
+ "'='", "'>'", "'begin'", "'else'", "'end'", "'float'", "'for'", "'if'",
+ "'int'", "'print'", "'program'", "'read'", "'string'", "'then'", "'while'",
+ "'todo'"
+ };
+ public static final int EOF=-1;
+ public static final int T__20=20;
+ public static final int T__21=21;
+ public static final int T__22=22;
+ public static final int T__23=23;
+ public static final int T__24=24;
+ public static final int T__25=25;
+ public static final int T__26=26;
+ public static final int T__27=27;
+ public static final int T__28=28;
+ public static final int T__29=29;
+ public static final int T__30=30;
+ public static final int T__31=31;
+ public static final int T__32=32;
+ public static final int T__33=33;
+ public static final int T__34=34;
+ public static final int T__35=35;
+ public static final int T__36=36;
+ public static final int T__37=37;
+ public static final int T__38=38;
+ public static final int T__39=39;
+ public static final int T__40=40;
+ public static final int T__41=41;
+ public static final int T__42=42;
+ public static final int T__43=43;
+ public static final int T__44=44;
+ public static final int T__45=45;
+ public static final int COMMENT=4;
+ public static final int DECL=5;
+ public static final int DECLLIST=6;
+ public static final int DIGIT=7;
+ public static final int FLOATCONST=8;
+ public static final int ID=9;
+ public static final int INTCONST=10;
+ public static final int INVALID=11;
+ public static final int LETTER=12;
+ public static final int OTHER=13;
+ public static final int POSDIGIT=14;
+ public static final int STATLIST=15;
+ public static final int STRINGCONST=16;
+ public static final int UMINUS=17;
+ public static final int WS=18;
+ public static final int ZERO=19;
+ public static final int T__46=46;
+ public static final int PLUS=23;
+
+ // delegates
+ public TreeRewriter[] getDelegates() {
+ return new TreeRewriter[] {};
+ }
+
+ // delegators
+
+
+ public XOptimizer(TreeNodeStream input) {
+ this(input, new RecognizerSharedState());
+ }
+ public XOptimizer(TreeNodeStream input, RecognizerSharedState state) {
+ super(input, state);
+ }
+
+ protected TreeAdaptor adaptor = new CommonTreeAdaptor();
+
+ public void setTreeAdaptor(TreeAdaptor adaptor) {
+ this.adaptor = adaptor;
+ }
+ public TreeAdaptor getTreeAdaptor() {
+ return adaptor;
+ }
+ @Override public String[] getTokenNames() { return XOptimizer.tokenNames; }
+ @Override public String getGrammarFileName() { return "C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XOptimizer.g"; }
+
+
+ private String addString(String first, String last) {
+ return first.substring(0, first.length()-1)+last.substring(1);
+ }
+
+ private String opInt(String first, String last, char op) {
+ int firstValue = 0;
+ int lastValue = 0;
+ try {
+ firstValue = Integer.parseInt(first);
+ lastValue = Integer.parseInt(last);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ switch (op) {
+ case '+': return Integer.toString(firstValue+lastValue);
+ case '-': return Integer.toString(firstValue-lastValue);
+ case '*': return Integer.toString(firstValue*lastValue);
+ case '/': return Integer.toString(firstValue/lastValue);
+ default: return "";
+ }
+ }
+
+ private String opFloat(String first, String last, char op) {
+ double firstValue = 0.0;
+ double lastValue = 0.0;
+ try {
+ firstValue = Double.parseDouble(first);
+ lastValue = Double.parseDouble(last);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ switch (op) {
+ case '+': return Double.toString(firstValue+lastValue);
+ case '-': return Double.toString(firstValue-lastValue);
+ case '*': return Double.toString(firstValue*lastValue);
+ case '/': return Double.toString(firstValue/lastValue);
+ default: return "";
+ }
+ }
+
+
+
+ public static class bottomup_return extends TreeRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "bottomup"
+ // C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XOptimizer.g:61:1: bottomup :;
+ @Override
+ public final XOptimizer.bottomup_return bottomup() throws RecognitionException {
+ XOptimizer.bottomup_return retval = new XOptimizer.bottomup_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ XTree _first_0 = null;
+ XTree _last = null;
+
+
+ try {
+ // C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XOptimizer.g:61:9: ()
+ // C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XOptimizer.g:61:11:
+ {
+ if ( state.backtracking==1 ) {
+ retval.tree = _first_0;
+ if ( adaptor.getParent(retval.tree)!=null && adaptor.isNil( adaptor.getParent(retval.tree) ) )
+ retval.tree = (XTree)adaptor.getParent(retval.tree);
+ }
+
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "bottomup"
+
+ // Delegated rules
+
+
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XOptimizer.tokens b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XOptimizer.tokens
new file mode 100644
index 0000000..c292af2
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XOptimizer.tokens
@@ -0,0 +1,71 @@
+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
+T__46=46
+PLUS=23
+'('=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
+'todo'=46
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XParser.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XParser.java
new file mode 100644
index 0000000..9360a17
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XParser.java
@@ -0,0 +1,2153 @@
+// $ANTLR 3.5.2 /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g 2020-06-10 10:19:34
+package de.dhbw.compiler.antlrxcompiler;
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.antlr.runtime.tree.*;
+
+
+@SuppressWarnings("all")
+public class XParser extends Parser {
+ public static final String[] tokenNames = new String[] {
+ "", "", "", "", "COMMENT", "DECL", "DECLLIST",
+ "DIGIT", "FLOATCONST", "ID", "INTCONST", "INVALID", "LETTER", "OTHER",
+ "POSDIGIT", "STATLIST", "STRINGCONST", "UMINUS", "WS", "ZERO", "'('",
+ "')'", "'*'", "'+'", "'-'", "'.'", "'/'", "':'", "':='", "';'", "'<'",
+ "'='", "'>'", "'begin'", "'else'", "'end'", "'float'", "'for'", "'if'",
+ "'int'", "'print'", "'program'", "'read'", "'string'", "'then'", "'while'"
+ };
+ public static final int EOF=-1;
+ public static final int T__20=20;
+ public static final int T__21=21;
+ public static final int T__22=22;
+ public static final int T__23=23;
+ public static final int T__24=24;
+ public static final int T__25=25;
+ public static final int T__26=26;
+ public static final int T__27=27;
+ public static final int T__28=28;
+ public static final int T__29=29;
+ public static final int T__30=30;
+ public static final int T__31=31;
+ public static final int T__32=32;
+ public static final int T__33=33;
+ public static final int T__34=34;
+ public static final int T__35=35;
+ public static final int T__36=36;
+ public static final int T__37=37;
+ public static final int T__38=38;
+ public static final int T__39=39;
+ public static final int T__40=40;
+ public static final int T__41=41;
+ public static final int T__42=42;
+ public static final int T__43=43;
+ public static final int T__44=44;
+ public static final int T__45=45;
+ public static final int COMMENT=4;
+ public static final int DECL=5;
+ public static final int DECLLIST=6;
+ public static final int DIGIT=7;
+ public static final int FLOATCONST=8;
+ public static final int ID=9;
+ public static final int INTCONST=10;
+ public static final int INVALID=11;
+ public static final int LETTER=12;
+ public static final int OTHER=13;
+ public static final int POSDIGIT=14;
+ public static final int STATLIST=15;
+ public static final int STRINGCONST=16;
+ public static final int UMINUS=17;
+ public static final int WS=18;
+ public static final int ZERO=19;
+
+ // delegates
+ public Parser[] getDelegates() {
+ return new Parser[] {};
+ }
+
+ // delegators
+
+
+ public XParser(TokenStream input) {
+ this(input, new RecognizerSharedState());
+ }
+ public XParser(TokenStream input, RecognizerSharedState state) {
+ super(input, state);
+ }
+
+ protected TreeAdaptor adaptor = new CommonTreeAdaptor();
+
+ public void setTreeAdaptor(TreeAdaptor adaptor) {
+ this.adaptor = adaptor;
+ }
+ public TreeAdaptor getTreeAdaptor() {
+ return adaptor;
+ }
+ @Override public String[] getTokenNames() { return XParser.tokenNames; }
+ @Override public String getGrammarFileName() { return "/Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g"; }
+
+
+ public static class decl_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "decl"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:55:1: decl : ( ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';' -> ^( DECL ID $type) | 'read' ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';' -> ^( DECL ID $type 'read' ) | 'print' ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';' -> ^( DECL ID $type 'print' ) | 'read' 'print' ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';' -> ^( DECL ID $type 'read' 'print' ) );
+ public final XParser.decl_return decl() throws RecognitionException {
+ XParser.decl_return retval = new XParser.decl_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token type=null;
+ Token ID1=null;
+ Token char_literal2=null;
+ Token char_literal3=null;
+ Token string_literal4=null;
+ Token ID5=null;
+ Token char_literal6=null;
+ Token char_literal7=null;
+ Token string_literal8=null;
+ Token ID9=null;
+ Token char_literal10=null;
+ Token char_literal11=null;
+ Token string_literal12=null;
+ Token string_literal13=null;
+ Token ID14=null;
+ Token char_literal15=null;
+ Token char_literal16=null;
+
+ XTree type_tree=null;
+ XTree ID1_tree=null;
+ XTree char_literal2_tree=null;
+ XTree char_literal3_tree=null;
+ XTree string_literal4_tree=null;
+ XTree ID5_tree=null;
+ XTree char_literal6_tree=null;
+ XTree char_literal7_tree=null;
+ XTree string_literal8_tree=null;
+ XTree ID9_tree=null;
+ XTree char_literal10_tree=null;
+ XTree char_literal11_tree=null;
+ XTree string_literal12_tree=null;
+ XTree string_literal13_tree=null;
+ XTree ID14_tree=null;
+ XTree char_literal15_tree=null;
+ XTree char_literal16_tree=null;
+ RewriteRuleTokenStream stream_36=new RewriteRuleTokenStream(adaptor,"token 36");
+ RewriteRuleTokenStream stream_27=new RewriteRuleTokenStream(adaptor,"token 27");
+ RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39");
+ RewriteRuleTokenStream stream_29=new RewriteRuleTokenStream(adaptor,"token 29");
+ RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
+ RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
+ RewriteRuleTokenStream stream_42=new RewriteRuleTokenStream(adaptor,"token 42");
+ RewriteRuleTokenStream stream_43=new RewriteRuleTokenStream(adaptor,"token 43");
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:55:5: ( ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';' -> ^( DECL ID $type) | 'read' ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';' -> ^( DECL ID $type 'read' ) | 'print' ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';' -> ^( DECL ID $type 'print' ) | 'read' 'print' ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';' -> ^( DECL ID $type 'read' 'print' ) )
+ int alt5=4;
+ switch ( input.LA(1) ) {
+ case ID:
+ {
+ alt5=1;
+ }
+ break;
+ case 42:
+ {
+ int LA5_2 = input.LA(2);
+ if ( (LA5_2==ID) ) {
+ alt5=2;
+ }
+ else if ( (LA5_2==40) ) {
+ alt5=4;
+ }
+
+ else {
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 5, 2, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+ break;
+ case 40:
+ {
+ alt5=3;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("", 5, 0, input);
+ throw nvae;
+ }
+ switch (alt5) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:55:14: ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';'
+ {
+ ID1=(Token)match(input,ID,FOLLOW_ID_in_decl396);
+ stream_ID.add(ID1);
+
+ char_literal2=(Token)match(input,27,FOLLOW_27_in_decl398);
+ stream_27.add(char_literal2);
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:55:21: (type= 'int' |type= 'float' |type= 'string' )
+ int alt1=3;
+ switch ( input.LA(1) ) {
+ case 39:
+ {
+ alt1=1;
+ }
+ break;
+ case 36:
+ {
+ alt1=2;
+ }
+ break;
+ case 43:
+ {
+ alt1=3;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("", 1, 0, input);
+ throw nvae;
+ }
+ switch (alt1) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:55:22: type= 'int'
+ {
+ type=(Token)match(input,39,FOLLOW_39_in_decl403);
+ stream_39.add(type);
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:55:35: type= 'float'
+ {
+ type=(Token)match(input,36,FOLLOW_36_in_decl409);
+ stream_36.add(type);
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:55:50: type= 'string'
+ {
+ type=(Token)match(input,43,FOLLOW_43_in_decl415);
+ stream_43.add(type);
+
+ }
+ break;
+
+ }
+
+ char_literal3=(Token)match(input,29,FOLLOW_29_in_decl418);
+ stream_29.add(char_literal3);
+
+ // AST REWRITE
+ // elements: ID, type
+ // token labels: type
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleTokenStream stream_type=new RewriteRuleTokenStream(adaptor,"token type",type);
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 55:69: -> ^( DECL ID $type)
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:55:72: ^( DECL ID $type)
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot((XTree)adaptor.create(DECL, "DECL"), root_1);
+ adaptor.addChild(root_1, stream_ID.nextNode());
+ adaptor.addChild(root_1, stream_type.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:56:14: 'read' ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';'
+ {
+ string_literal4=(Token)match(input,42,FOLLOW_42_in_decl444);
+ stream_42.add(string_literal4);
+
+ ID5=(Token)match(input,ID,FOLLOW_ID_in_decl446);
+ stream_ID.add(ID5);
+
+ char_literal6=(Token)match(input,27,FOLLOW_27_in_decl448);
+ stream_27.add(char_literal6);
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:56:28: (type= 'int' |type= 'float' |type= 'string' )
+ int alt2=3;
+ switch ( input.LA(1) ) {
+ case 39:
+ {
+ alt2=1;
+ }
+ break;
+ case 36:
+ {
+ alt2=2;
+ }
+ break;
+ case 43:
+ {
+ alt2=3;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("", 2, 0, input);
+ throw nvae;
+ }
+ switch (alt2) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:56:29: type= 'int'
+ {
+ type=(Token)match(input,39,FOLLOW_39_in_decl453);
+ stream_39.add(type);
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:56:42: type= 'float'
+ {
+ type=(Token)match(input,36,FOLLOW_36_in_decl459);
+ stream_36.add(type);
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:56:57: type= 'string'
+ {
+ type=(Token)match(input,43,FOLLOW_43_in_decl465);
+ stream_43.add(type);
+
+ }
+ break;
+
+ }
+
+ char_literal7=(Token)match(input,29,FOLLOW_29_in_decl468);
+ stream_29.add(char_literal7);
+
+ // AST REWRITE
+ // elements: ID, type, 42
+ // token labels: type
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleTokenStream stream_type=new RewriteRuleTokenStream(adaptor,"token type",type);
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 56:76: -> ^( DECL ID $type 'read' )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:56:79: ^( DECL ID $type 'read' )
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot((XTree)adaptor.create(DECL, "DECL"), root_1);
+ adaptor.addChild(root_1, stream_ID.nextNode());
+ adaptor.addChild(root_1, stream_type.nextNode());
+ adaptor.addChild(root_1, stream_42.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:57:14: 'print' ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';'
+ {
+ string_literal8=(Token)match(input,40,FOLLOW_40_in_decl496);
+ stream_40.add(string_literal8);
+
+ ID9=(Token)match(input,ID,FOLLOW_ID_in_decl498);
+ stream_ID.add(ID9);
+
+ char_literal10=(Token)match(input,27,FOLLOW_27_in_decl500);
+ stream_27.add(char_literal10);
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:57:29: (type= 'int' |type= 'float' |type= 'string' )
+ int alt3=3;
+ switch ( input.LA(1) ) {
+ case 39:
+ {
+ alt3=1;
+ }
+ break;
+ case 36:
+ {
+ alt3=2;
+ }
+ break;
+ case 43:
+ {
+ alt3=3;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("", 3, 0, input);
+ throw nvae;
+ }
+ switch (alt3) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:57:30: type= 'int'
+ {
+ type=(Token)match(input,39,FOLLOW_39_in_decl505);
+ stream_39.add(type);
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:57:43: type= 'float'
+ {
+ type=(Token)match(input,36,FOLLOW_36_in_decl511);
+ stream_36.add(type);
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:57:58: type= 'string'
+ {
+ type=(Token)match(input,43,FOLLOW_43_in_decl517);
+ stream_43.add(type);
+
+ }
+ break;
+
+ }
+
+ char_literal11=(Token)match(input,29,FOLLOW_29_in_decl520);
+ stream_29.add(char_literal11);
+
+ // AST REWRITE
+ // elements: 40, ID, type
+ // token labels: type
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleTokenStream stream_type=new RewriteRuleTokenStream(adaptor,"token type",type);
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 57:77: -> ^( DECL ID $type 'print' )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:57:80: ^( DECL ID $type 'print' )
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot((XTree)adaptor.create(DECL, "DECL"), root_1);
+ adaptor.addChild(root_1, stream_ID.nextNode());
+ adaptor.addChild(root_1, stream_type.nextNode());
+ adaptor.addChild(root_1, stream_40.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+ break;
+ case 4 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:58:14: 'read' 'print' ID ':' (type= 'int' |type= 'float' |type= 'string' ) ';'
+ {
+ string_literal12=(Token)match(input,42,FOLLOW_42_in_decl548);
+ stream_42.add(string_literal12);
+
+ string_literal13=(Token)match(input,40,FOLLOW_40_in_decl550);
+ stream_40.add(string_literal13);
+
+ ID14=(Token)match(input,ID,FOLLOW_ID_in_decl552);
+ stream_ID.add(ID14);
+
+ char_literal15=(Token)match(input,27,FOLLOW_27_in_decl554);
+ stream_27.add(char_literal15);
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:58:36: (type= 'int' |type= 'float' |type= 'string' )
+ int alt4=3;
+ switch ( input.LA(1) ) {
+ case 39:
+ {
+ alt4=1;
+ }
+ break;
+ case 36:
+ {
+ alt4=2;
+ }
+ break;
+ case 43:
+ {
+ alt4=3;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("", 4, 0, input);
+ throw nvae;
+ }
+ switch (alt4) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:58:37: type= 'int'
+ {
+ type=(Token)match(input,39,FOLLOW_39_in_decl559);
+ stream_39.add(type);
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:58:50: type= 'float'
+ {
+ type=(Token)match(input,36,FOLLOW_36_in_decl565);
+ stream_36.add(type);
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:58:65: type= 'string'
+ {
+ type=(Token)match(input,43,FOLLOW_43_in_decl571);
+ stream_43.add(type);
+
+ }
+ break;
+
+ }
+
+ char_literal16=(Token)match(input,29,FOLLOW_29_in_decl574);
+ stream_29.add(char_literal16);
+
+ // AST REWRITE
+ // elements: 40, ID, 42, type
+ // token labels: type
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleTokenStream stream_type=new RewriteRuleTokenStream(adaptor,"token type",type);
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 58:84: -> ^( DECL ID $type 'read' 'print' )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:58:87: ^( DECL ID $type 'read' 'print' )
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot((XTree)adaptor.create(DECL, "DECL"), root_1);
+ adaptor.addChild(root_1, stream_ID.nextNode());
+ adaptor.addChild(root_1, stream_type.nextNode());
+ adaptor.addChild(root_1, stream_42.nextNode());
+ adaptor.addChild(root_1, stream_40.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "decl"
+
+
+ public static class decllist_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "decllist"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:60:1: decllist : ( decl )* -> ^( DECLLIST ( decl )* ) ;
+ public final XParser.decllist_return decllist() throws RecognitionException {
+ XParser.decllist_return retval = new XParser.decllist_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ ParserRuleReturnScope decl17 =null;
+
+ RewriteRuleSubtreeStream stream_decl=new RewriteRuleSubtreeStream(adaptor,"rule decl");
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:60:9: ( ( decl )* -> ^( DECLLIST ( decl )* ) )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:60:15: ( decl )*
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:60:15: ( decl )*
+ loop6:
+ while (true) {
+ int alt6=2;
+ int LA6_0 = input.LA(1);
+ if ( (LA6_0==ID||LA6_0==40||LA6_0==42) ) {
+ alt6=1;
+ }
+
+ switch (alt6) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:60:15: decl
+ {
+ pushFollow(FOLLOW_decl_in_decllist600);
+ decl17=decl();
+ state._fsp--;
+
+ stream_decl.add(decl17.getTree());
+ }
+ break;
+
+ default :
+ break loop6;
+ }
+ }
+
+ // AST REWRITE
+ // elements: decl
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 60:22: -> ^( DECLLIST ( decl )* )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:60:25: ^( DECLLIST ( decl )* )
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot((XTree)adaptor.create(DECLLIST, "DECLLIST"), root_1);
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:60:36: ( decl )*
+ while ( stream_decl.hasNext() ) {
+ adaptor.addChild(root_1, stream_decl.nextTree());
+ }
+ stream_decl.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "decllist"
+
+
+ public static class expr_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "expr"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:63:1: expr : multexpr ( ( '+' ^| '-' ^) multexpr )* ;
+ public final XParser.expr_return expr() throws RecognitionException {
+ XParser.expr_return retval = new XParser.expr_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token char_literal19=null;
+ Token char_literal20=null;
+ ParserRuleReturnScope multexpr18 =null;
+ ParserRuleReturnScope multexpr21 =null;
+
+ XTree char_literal19_tree=null;
+ XTree char_literal20_tree=null;
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:63:5: ( multexpr ( ( '+' ^| '-' ^) multexpr )* )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:63:15: multexpr ( ( '+' ^| '-' ^) multexpr )*
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_multexpr_in_expr627);
+ multexpr18=multexpr();
+ state._fsp--;
+
+ adaptor.addChild(root_0, multexpr18.getTree());
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:63:24: ( ( '+' ^| '-' ^) multexpr )*
+ loop8:
+ while (true) {
+ int alt8=2;
+ int LA8_0 = input.LA(1);
+ if ( ((LA8_0 >= 23 && LA8_0 <= 24)) ) {
+ alt8=1;
+ }
+
+ switch (alt8) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:63:25: ( '+' ^| '-' ^) multexpr
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:63:25: ( '+' ^| '-' ^)
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+ if ( (LA7_0==23) ) {
+ alt7=1;
+ }
+ else if ( (LA7_0==24) ) {
+ alt7=2;
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 7, 0, input);
+ throw nvae;
+ }
+
+ switch (alt7) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:63:26: '+' ^
+ {
+ char_literal19=(Token)match(input,23,FOLLOW_23_in_expr631);
+ char_literal19_tree = (XTree)adaptor.create(char_literal19);
+ root_0 = (XTree)adaptor.becomeRoot(char_literal19_tree, root_0);
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:63:33: '-' ^
+ {
+ char_literal20=(Token)match(input,24,FOLLOW_24_in_expr636);
+ char_literal20_tree = (XTree)adaptor.create(char_literal20);
+ root_0 = (XTree)adaptor.becomeRoot(char_literal20_tree, root_0);
+
+ }
+ break;
+
+ }
+
+ pushFollow(FOLLOW_multexpr_in_expr640);
+ multexpr21=multexpr();
+ state._fsp--;
+
+ adaptor.addChild(root_0, multexpr21.getTree());
+
+ }
+ break;
+
+ default :
+ break loop8;
+ }
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "expr"
+
+
+ public static class multexpr_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "multexpr"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:64:1: multexpr : simpleexpr ( ( '*' ^| '/' ^) simpleexpr )* ;
+ public final XParser.multexpr_return multexpr() throws RecognitionException {
+ XParser.multexpr_return retval = new XParser.multexpr_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token char_literal23=null;
+ Token char_literal24=null;
+ ParserRuleReturnScope simpleexpr22 =null;
+ ParserRuleReturnScope simpleexpr25 =null;
+
+ XTree char_literal23_tree=null;
+ XTree char_literal24_tree=null;
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:64:9: ( simpleexpr ( ( '*' ^| '/' ^) simpleexpr )* )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:64:14: simpleexpr ( ( '*' ^| '/' ^) simpleexpr )*
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_simpleexpr_in_multexpr651);
+ simpleexpr22=simpleexpr();
+ state._fsp--;
+
+ adaptor.addChild(root_0, simpleexpr22.getTree());
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:64:25: ( ( '*' ^| '/' ^) simpleexpr )*
+ loop10:
+ while (true) {
+ int alt10=2;
+ int LA10_0 = input.LA(1);
+ if ( (LA10_0==22||LA10_0==26) ) {
+ alt10=1;
+ }
+
+ switch (alt10) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:64:26: ( '*' ^| '/' ^) simpleexpr
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:64:26: ( '*' ^| '/' ^)
+ int alt9=2;
+ int LA9_0 = input.LA(1);
+ if ( (LA9_0==22) ) {
+ alt9=1;
+ }
+ else if ( (LA9_0==26) ) {
+ alt9=2;
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 9, 0, input);
+ throw nvae;
+ }
+
+ switch (alt9) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:64:27: '*' ^
+ {
+ char_literal23=(Token)match(input,22,FOLLOW_22_in_multexpr655);
+ char_literal23_tree = (XTree)adaptor.create(char_literal23);
+ root_0 = (XTree)adaptor.becomeRoot(char_literal23_tree, root_0);
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:64:34: '/' ^
+ {
+ char_literal24=(Token)match(input,26,FOLLOW_26_in_multexpr660);
+ char_literal24_tree = (XTree)adaptor.create(char_literal24);
+ root_0 = (XTree)adaptor.becomeRoot(char_literal24_tree, root_0);
+
+ }
+ break;
+
+ }
+
+ pushFollow(FOLLOW_simpleexpr_in_multexpr664);
+ simpleexpr25=simpleexpr();
+ state._fsp--;
+
+ adaptor.addChild(root_0, simpleexpr25.getTree());
+
+ }
+ break;
+
+ default :
+ break loop10;
+ }
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "multexpr"
+
+
+ public static class simpleexpr_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "simpleexpr"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:65:1: simpleexpr : ( '(' ! expr ')' !| INTCONST | '-' INTCONST -> ^( UMINUS INTCONST ) | FLOATCONST | '-' FLOATCONST -> ^( UMINUS FLOATCONST ) | ID | STRINGCONST );
+ public final XParser.simpleexpr_return simpleexpr() throws RecognitionException {
+ XParser.simpleexpr_return retval = new XParser.simpleexpr_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token char_literal26=null;
+ Token char_literal28=null;
+ Token INTCONST29=null;
+ Token char_literal30=null;
+ Token INTCONST31=null;
+ Token FLOATCONST32=null;
+ Token char_literal33=null;
+ Token FLOATCONST34=null;
+ Token ID35=null;
+ Token STRINGCONST36=null;
+ ParserRuleReturnScope expr27 =null;
+
+ XTree char_literal26_tree=null;
+ XTree char_literal28_tree=null;
+ XTree INTCONST29_tree=null;
+ XTree char_literal30_tree=null;
+ XTree INTCONST31_tree=null;
+ XTree FLOATCONST32_tree=null;
+ XTree char_literal33_tree=null;
+ XTree FLOATCONST34_tree=null;
+ XTree ID35_tree=null;
+ XTree STRINGCONST36_tree=null;
+ RewriteRuleTokenStream stream_24=new RewriteRuleTokenStream(adaptor,"token 24");
+ RewriteRuleTokenStream stream_FLOATCONST=new RewriteRuleTokenStream(adaptor,"token FLOATCONST");
+ RewriteRuleTokenStream stream_INTCONST=new RewriteRuleTokenStream(adaptor,"token INTCONST");
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:65:11: ( '(' ! expr ')' !| INTCONST | '-' INTCONST -> ^( UMINUS INTCONST ) | FLOATCONST | '-' FLOATCONST -> ^( UMINUS FLOATCONST ) | ID | STRINGCONST )
+ int alt11=7;
+ switch ( input.LA(1) ) {
+ case 20:
+ {
+ alt11=1;
+ }
+ break;
+ case INTCONST:
+ {
+ alt11=2;
+ }
+ break;
+ case 24:
+ {
+ int LA11_3 = input.LA(2);
+ if ( (LA11_3==INTCONST) ) {
+ alt11=3;
+ }
+ else if ( (LA11_3==FLOATCONST) ) {
+ alt11=5;
+ }
+
+ else {
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 11, 3, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+ break;
+ case FLOATCONST:
+ {
+ alt11=4;
+ }
+ break;
+ case ID:
+ {
+ alt11=6;
+ }
+ break;
+ case STRINGCONST:
+ {
+ alt11=7;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("", 11, 0, input);
+ throw nvae;
+ }
+ switch (alt11) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:65:15: '(' ! expr ')' !
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ char_literal26=(Token)match(input,20,FOLLOW_20_in_simpleexpr674);
+ pushFollow(FOLLOW_expr_in_simpleexpr677);
+ expr27=expr();
+ state._fsp--;
+
+ adaptor.addChild(root_0, expr27.getTree());
+
+ char_literal28=(Token)match(input,21,FOLLOW_21_in_simpleexpr679);
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:66:15: INTCONST
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ INTCONST29=(Token)match(input,INTCONST,FOLLOW_INTCONST_in_simpleexpr697);
+ INTCONST29_tree = (XTree)adaptor.create(INTCONST29);
+ adaptor.addChild(root_0, INTCONST29_tree);
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:66:26: '-' INTCONST
+ {
+ char_literal30=(Token)match(input,24,FOLLOW_24_in_simpleexpr701);
+ stream_24.add(char_literal30);
+
+ INTCONST31=(Token)match(input,INTCONST,FOLLOW_INTCONST_in_simpleexpr703);
+ stream_INTCONST.add(INTCONST31);
+
+ // AST REWRITE
+ // elements: INTCONST
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 66:39: -> ^( UMINUS INTCONST )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:66:42: ^( UMINUS INTCONST )
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot((XTree)adaptor.create(UMINUS, "UMINUS"), root_1);
+ adaptor.addChild(root_1, stream_INTCONST.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+ break;
+ case 4 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:67:15: FLOATCONST
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ FLOATCONST32=(Token)match(input,FLOATCONST,FOLLOW_FLOATCONST_in_simpleexpr727);
+ FLOATCONST32_tree = (XTree)adaptor.create(FLOATCONST32);
+ adaptor.addChild(root_0, FLOATCONST32_tree);
+
+ }
+ break;
+ case 5 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:67:28: '-' FLOATCONST
+ {
+ char_literal33=(Token)match(input,24,FOLLOW_24_in_simpleexpr731);
+ stream_24.add(char_literal33);
+
+ FLOATCONST34=(Token)match(input,FLOATCONST,FOLLOW_FLOATCONST_in_simpleexpr733);
+ stream_FLOATCONST.add(FLOATCONST34);
+
+ // AST REWRITE
+ // elements: FLOATCONST
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 67:43: -> ^( UMINUS FLOATCONST )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:67:46: ^( UMINUS FLOATCONST )
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot((XTree)adaptor.create(UMINUS, "UMINUS"), root_1);
+ adaptor.addChild(root_1, stream_FLOATCONST.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+ break;
+ case 6 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:68:15: ID
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ ID35=(Token)match(input,ID,FOLLOW_ID_in_simpleexpr757);
+ ID35_tree = (XTree)adaptor.create(ID35);
+ adaptor.addChild(root_0, ID35_tree);
+
+ }
+ break;
+ case 7 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:68:20: STRINGCONST
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ STRINGCONST36=(Token)match(input,STRINGCONST,FOLLOW_STRINGCONST_in_simpleexpr761);
+ STRINGCONST36_tree = (XTree)adaptor.create(STRINGCONST36);
+ adaptor.addChild(root_0, STRINGCONST36_tree);
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "simpleexpr"
+
+
+ public static class assignstat_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "assignstat"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:71:1: assignstat : ID ':=' ^ expr ;
+ public final XParser.assignstat_return assignstat() throws RecognitionException {
+ XParser.assignstat_return retval = new XParser.assignstat_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token ID37=null;
+ Token string_literal38=null;
+ ParserRuleReturnScope expr39 =null;
+
+ XTree ID37_tree=null;
+ XTree string_literal38_tree=null;
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:71:11: ( ID ':=' ^ expr )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:71:15: ID ':=' ^ expr
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ ID37=(Token)match(input,ID,FOLLOW_ID_in_assignstat771);
+ ID37_tree = (XTree)adaptor.create(ID37);
+ adaptor.addChild(root_0, ID37_tree);
+
+ string_literal38=(Token)match(input,28,FOLLOW_28_in_assignstat773);
+ string_literal38_tree = (XTree)adaptor.create(string_literal38);
+ root_0 = (XTree)adaptor.becomeRoot(string_literal38_tree, root_0);
+
+ pushFollow(FOLLOW_expr_in_assignstat776);
+ expr39=expr();
+ state._fsp--;
+
+ adaptor.addChild(root_0, expr39.getTree());
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "assignstat"
+
+
+ public static class cond_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "cond"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:74:1: cond : expr ( '<' ^| '>' ^| '=' ^) expr ;
+ public final XParser.cond_return cond() throws RecognitionException {
+ XParser.cond_return retval = new XParser.cond_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token char_literal41=null;
+ Token char_literal42=null;
+ Token char_literal43=null;
+ ParserRuleReturnScope expr40 =null;
+ ParserRuleReturnScope expr44 =null;
+
+ XTree char_literal41_tree=null;
+ XTree char_literal42_tree=null;
+ XTree char_literal43_tree=null;
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:74:5: ( expr ( '<' ^| '>' ^| '=' ^) expr )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:74:15: expr ( '<' ^| '>' ^| '=' ^) expr
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_expr_in_cond792);
+ expr40=expr();
+ state._fsp--;
+
+ adaptor.addChild(root_0, expr40.getTree());
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:74:20: ( '<' ^| '>' ^| '=' ^)
+ int alt12=3;
+ switch ( input.LA(1) ) {
+ case 30:
+ {
+ alt12=1;
+ }
+ break;
+ case 32:
+ {
+ alt12=2;
+ }
+ break;
+ case 31:
+ {
+ alt12=3;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("", 12, 0, input);
+ throw nvae;
+ }
+ switch (alt12) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:74:21: '<' ^
+ {
+ char_literal41=(Token)match(input,30,FOLLOW_30_in_cond795);
+ char_literal41_tree = (XTree)adaptor.create(char_literal41);
+ root_0 = (XTree)adaptor.becomeRoot(char_literal41_tree, root_0);
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:74:27: '>' ^
+ {
+ char_literal42=(Token)match(input,32,FOLLOW_32_in_cond799);
+ char_literal42_tree = (XTree)adaptor.create(char_literal42);
+ root_0 = (XTree)adaptor.becomeRoot(char_literal42_tree, root_0);
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:74:33: '=' ^
+ {
+ char_literal43=(Token)match(input,31,FOLLOW_31_in_cond803);
+ char_literal43_tree = (XTree)adaptor.create(char_literal43);
+ root_0 = (XTree)adaptor.becomeRoot(char_literal43_tree, root_0);
+
+ }
+ break;
+
+ }
+
+ pushFollow(FOLLOW_expr_in_cond808);
+ expr44=expr();
+ state._fsp--;
+
+ adaptor.addChild(root_0, expr44.getTree());
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "cond"
+
+
+ public static class condstat_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "condstat"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:77:1: condstat : 'if' ^ cond 'then' ! stat ( options {greedy=true; } : 'else' ! stat )? ;
+ public final XParser.condstat_return condstat() throws RecognitionException {
+ XParser.condstat_return retval = new XParser.condstat_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token string_literal45=null;
+ Token string_literal47=null;
+ Token string_literal49=null;
+ ParserRuleReturnScope cond46 =null;
+ ParserRuleReturnScope stat48 =null;
+ ParserRuleReturnScope stat50 =null;
+
+ XTree string_literal45_tree=null;
+ XTree string_literal47_tree=null;
+ XTree string_literal49_tree=null;
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:77:9: ( 'if' ^ cond 'then' ! stat ( options {greedy=true; } : 'else' ! stat )? )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:77:15: 'if' ^ cond 'then' ! stat ( options {greedy=true; } : 'else' ! stat )?
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ string_literal45=(Token)match(input,38,FOLLOW_38_in_condstat820);
+ string_literal45_tree = (XTree)adaptor.create(string_literal45);
+ root_0 = (XTree)adaptor.becomeRoot(string_literal45_tree, root_0);
+
+ pushFollow(FOLLOW_cond_in_condstat823);
+ cond46=cond();
+ state._fsp--;
+
+ adaptor.addChild(root_0, cond46.getTree());
+
+ string_literal47=(Token)match(input,44,FOLLOW_44_in_condstat825);
+ pushFollow(FOLLOW_stat_in_condstat828);
+ stat48=stat();
+ state._fsp--;
+
+ adaptor.addChild(root_0, stat48.getTree());
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:77:40: ( options {greedy=true; } : 'else' ! stat )?
+ int alt13=2;
+ int LA13_0 = input.LA(1);
+ if ( (LA13_0==34) ) {
+ alt13=1;
+ }
+ switch (alt13) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:77:65: 'else' ! stat
+ {
+ string_literal49=(Token)match(input,34,FOLLOW_34_in_condstat840);
+ pushFollow(FOLLOW_stat_in_condstat843);
+ stat50=stat();
+ state._fsp--;
+
+ adaptor.addChild(root_0, stat50.getTree());
+
+ }
+ break;
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "condstat"
+
+
+ public static class whilestat_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "whilestat"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:80:1: whilestat : 'while' '(' cond ')' stat -> ^( 'while' cond stat ) ;
+ public final XParser.whilestat_return whilestat() throws RecognitionException {
+ XParser.whilestat_return retval = new XParser.whilestat_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token string_literal51=null;
+ Token char_literal52=null;
+ Token char_literal54=null;
+ ParserRuleReturnScope cond53 =null;
+ ParserRuleReturnScope stat55 =null;
+
+ XTree string_literal51_tree=null;
+ XTree char_literal52_tree=null;
+ XTree char_literal54_tree=null;
+ RewriteRuleTokenStream stream_45=new RewriteRuleTokenStream(adaptor,"token 45");
+ RewriteRuleTokenStream stream_20=new RewriteRuleTokenStream(adaptor,"token 20");
+ RewriteRuleTokenStream stream_21=new RewriteRuleTokenStream(adaptor,"token 21");
+ RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat");
+ RewriteRuleSubtreeStream stream_cond=new RewriteRuleSubtreeStream(adaptor,"rule cond");
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:80:10: ( 'while' '(' cond ')' stat -> ^( 'while' cond stat ) )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:80:15: 'while' '(' cond ')' stat
+ {
+ string_literal51=(Token)match(input,45,FOLLOW_45_in_whilestat856);
+ stream_45.add(string_literal51);
+
+ char_literal52=(Token)match(input,20,FOLLOW_20_in_whilestat858);
+ stream_20.add(char_literal52);
+
+ pushFollow(FOLLOW_cond_in_whilestat860);
+ cond53=cond();
+ state._fsp--;
+
+ stream_cond.add(cond53.getTree());
+ char_literal54=(Token)match(input,21,FOLLOW_21_in_whilestat862);
+ stream_21.add(char_literal54);
+
+ pushFollow(FOLLOW_stat_in_whilestat864);
+ stat55=stat();
+ state._fsp--;
+
+ stream_stat.add(stat55.getTree());
+ // AST REWRITE
+ // elements: stat, 45, cond
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 80:41: -> ^( 'while' cond stat )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:80:44: ^( 'while' cond stat )
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot(stream_45.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_cond.nextTree());
+ adaptor.addChild(root_1, stream_stat.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "whilestat"
+
+
+ public static class forstat_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "forstat"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:81:1: forstat : 'for' ^ '(' ! assignstat ';' ! cond ';' ! assignstat ')' ! stat ;
+ public final XParser.forstat_return forstat() throws RecognitionException {
+ XParser.forstat_return retval = new XParser.forstat_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token string_literal56=null;
+ Token char_literal57=null;
+ Token char_literal59=null;
+ Token char_literal61=null;
+ Token char_literal63=null;
+ ParserRuleReturnScope assignstat58 =null;
+ ParserRuleReturnScope cond60 =null;
+ ParserRuleReturnScope assignstat62 =null;
+ ParserRuleReturnScope stat64 =null;
+
+ XTree string_literal56_tree=null;
+ XTree char_literal57_tree=null;
+ XTree char_literal59_tree=null;
+ XTree char_literal61_tree=null;
+ XTree char_literal63_tree=null;
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:81:8: ( 'for' ^ '(' ! assignstat ';' ! cond ';' ! assignstat ')' ! stat )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:81:15: 'for' ^ '(' ! assignstat ';' ! cond ';' ! assignstat ')' ! stat
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ string_literal56=(Token)match(input,37,FOLLOW_37_in_forstat885);
+ string_literal56_tree = (XTree)adaptor.create(string_literal56);
+ root_0 = (XTree)adaptor.becomeRoot(string_literal56_tree, root_0);
+
+ char_literal57=(Token)match(input,20,FOLLOW_20_in_forstat888);
+ pushFollow(FOLLOW_assignstat_in_forstat891);
+ assignstat58=assignstat();
+ state._fsp--;
+
+ adaptor.addChild(root_0, assignstat58.getTree());
+
+ char_literal59=(Token)match(input,29,FOLLOW_29_in_forstat893);
+ pushFollow(FOLLOW_cond_in_forstat896);
+ cond60=cond();
+ state._fsp--;
+
+ adaptor.addChild(root_0, cond60.getTree());
+
+ char_literal61=(Token)match(input,29,FOLLOW_29_in_forstat898);
+ pushFollow(FOLLOW_assignstat_in_forstat901);
+ assignstat62=assignstat();
+ state._fsp--;
+
+ adaptor.addChild(root_0, assignstat62.getTree());
+
+ char_literal63=(Token)match(input,21,FOLLOW_21_in_forstat903);
+ pushFollow(FOLLOW_stat_in_forstat906);
+ stat64=stat();
+ state._fsp--;
+
+ adaptor.addChild(root_0, stat64.getTree());
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "forstat"
+
+
+ public static class stat_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "stat"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:84:1: stat : ( assignstat | condstat | whilestat | forstat | statlist );
+ public final XParser.stat_return stat() throws RecognitionException {
+ XParser.stat_return retval = new XParser.stat_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ ParserRuleReturnScope assignstat65 =null;
+ ParserRuleReturnScope condstat66 =null;
+ ParserRuleReturnScope whilestat67 =null;
+ ParserRuleReturnScope forstat68 =null;
+ ParserRuleReturnScope statlist69 =null;
+
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:84:5: ( assignstat | condstat | whilestat | forstat | statlist )
+ int alt14=5;
+ switch ( input.LA(1) ) {
+ case ID:
+ {
+ alt14=1;
+ }
+ break;
+ case 38:
+ {
+ alt14=2;
+ }
+ break;
+ case 45:
+ {
+ alt14=3;
+ }
+ break;
+ case 37:
+ {
+ alt14=4;
+ }
+ break;
+ case 33:
+ {
+ alt14=5;
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("", 14, 0, input);
+ throw nvae;
+ }
+ switch (alt14) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:84:15: assignstat
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_assignstat_in_stat922);
+ assignstat65=assignstat();
+ state._fsp--;
+
+ adaptor.addChild(root_0, assignstat65.getTree());
+
+ }
+ break;
+ case 2 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:84:28: condstat
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_condstat_in_stat926);
+ condstat66=condstat();
+ state._fsp--;
+
+ adaptor.addChild(root_0, condstat66.getTree());
+
+ }
+ break;
+ case 3 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:84:39: whilestat
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_whilestat_in_stat930);
+ whilestat67=whilestat();
+ state._fsp--;
+
+ adaptor.addChild(root_0, whilestat67.getTree());
+
+ }
+ break;
+ case 4 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:84:51: forstat
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_forstat_in_stat934);
+ forstat68=forstat();
+ state._fsp--;
+
+ adaptor.addChild(root_0, forstat68.getTree());
+
+ }
+ break;
+ case 5 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:84:61: statlist
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_statlist_in_stat938);
+ statlist69=statlist();
+ state._fsp--;
+
+ adaptor.addChild(root_0, statlist69.getTree());
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "stat"
+
+
+ public static class statlist_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "statlist"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:86:1: statlist : 'begin' ( stat ';' )* 'end' -> ^( STATLIST ( stat )* ) ;
+ public final XParser.statlist_return statlist() throws RecognitionException {
+ XParser.statlist_return retval = new XParser.statlist_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token string_literal70=null;
+ Token char_literal72=null;
+ Token string_literal73=null;
+ ParserRuleReturnScope stat71 =null;
+
+ XTree string_literal70_tree=null;
+ XTree char_literal72_tree=null;
+ XTree string_literal73_tree=null;
+ RewriteRuleTokenStream stream_33=new RewriteRuleTokenStream(adaptor,"token 33");
+ RewriteRuleTokenStream stream_35=new RewriteRuleTokenStream(adaptor,"token 35");
+ RewriteRuleTokenStream stream_29=new RewriteRuleTokenStream(adaptor,"token 29");
+ RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat");
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:86:9: ( 'begin' ( stat ';' )* 'end' -> ^( STATLIST ( stat )* ) )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:86:18: 'begin' ( stat ';' )* 'end'
+ {
+ string_literal70=(Token)match(input,33,FOLLOW_33_in_statlist952);
+ stream_33.add(string_literal70);
+
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:86:26: ( stat ';' )*
+ loop15:
+ while (true) {
+ int alt15=2;
+ int LA15_0 = input.LA(1);
+ if ( (LA15_0==ID||LA15_0==33||(LA15_0 >= 37 && LA15_0 <= 38)||LA15_0==45) ) {
+ alt15=1;
+ }
+
+ switch (alt15) {
+ case 1 :
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:86:27: stat ';'
+ {
+ pushFollow(FOLLOW_stat_in_statlist955);
+ stat71=stat();
+ state._fsp--;
+
+ stream_stat.add(stat71.getTree());
+ char_literal72=(Token)match(input,29,FOLLOW_29_in_statlist957);
+ stream_29.add(char_literal72);
+
+ }
+ break;
+
+ default :
+ break loop15;
+ }
+ }
+
+ string_literal73=(Token)match(input,35,FOLLOW_35_in_statlist961);
+ stream_35.add(string_literal73);
+
+ // AST REWRITE
+ // elements: stat
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 86:45: -> ^( STATLIST ( stat )* )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:86:48: ^( STATLIST ( stat )* )
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot((XTree)adaptor.create(STATLIST, "STATLIST"), root_1);
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:86:59: ( stat )*
+ while ( stream_stat.hasNext() ) {
+ adaptor.addChild(root_1, stream_stat.nextTree());
+ }
+ stream_stat.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "statlist"
+
+
+ public static class program_return extends ParserRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "program"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:89:1: program : 'program' ID ';' decllist statlist '.' EOF -> ^( 'program' ID decllist statlist ) ;
+ public final XParser.program_return program() throws RecognitionException {
+ XParser.program_return retval = new XParser.program_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ Token string_literal74=null;
+ Token ID75=null;
+ Token char_literal76=null;
+ Token char_literal79=null;
+ Token EOF80=null;
+ ParserRuleReturnScope decllist77 =null;
+ ParserRuleReturnScope statlist78 =null;
+
+ XTree string_literal74_tree=null;
+ XTree ID75_tree=null;
+ XTree char_literal76_tree=null;
+ XTree char_literal79_tree=null;
+ XTree EOF80_tree=null;
+ RewriteRuleTokenStream stream_25=new RewriteRuleTokenStream(adaptor,"token 25");
+ RewriteRuleTokenStream stream_29=new RewriteRuleTokenStream(adaptor,"token 29");
+ RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
+ RewriteRuleTokenStream stream_41=new RewriteRuleTokenStream(adaptor,"token 41");
+ RewriteRuleTokenStream stream_EOF=new RewriteRuleTokenStream(adaptor,"token EOF");
+ RewriteRuleSubtreeStream stream_decllist=new RewriteRuleSubtreeStream(adaptor,"rule decllist");
+ RewriteRuleSubtreeStream stream_statlist=new RewriteRuleSubtreeStream(adaptor,"rule statlist");
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:89:8: ( 'program' ID ';' decllist statlist '.' EOF -> ^( 'program' ID decllist statlist ) )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:89:15: 'program' ID ';' decllist statlist '.' EOF
+ {
+ string_literal74=(Token)match(input,41,FOLLOW_41_in_program984);
+ stream_41.add(string_literal74);
+
+ ID75=(Token)match(input,ID,FOLLOW_ID_in_program986);
+ stream_ID.add(ID75);
+
+ char_literal76=(Token)match(input,29,FOLLOW_29_in_program988);
+ stream_29.add(char_literal76);
+
+ pushFollow(FOLLOW_decllist_in_program990);
+ decllist77=decllist();
+ state._fsp--;
+
+ stream_decllist.add(decllist77.getTree());
+ pushFollow(FOLLOW_statlist_in_program992);
+ statlist78=statlist();
+ state._fsp--;
+
+ stream_statlist.add(statlist78.getTree());
+ char_literal79=(Token)match(input,25,FOLLOW_25_in_program994);
+ stream_25.add(char_literal79);
+
+ EOF80=(Token)match(input,EOF,FOLLOW_EOF_in_program996);
+ stream_EOF.add(EOF80);
+
+ // AST REWRITE
+ // elements: ID, statlist, decllist, 41
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (XTree)adaptor.nil();
+ // 89:58: -> ^( 'program' ID decllist statlist )
+ {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/X.g:89:61: ^( 'program' ID decllist statlist )
+ {
+ XTree root_1 = (XTree)adaptor.nil();
+ root_1 = (XTree)adaptor.becomeRoot(stream_41.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_ID.nextNode());
+ adaptor.addChild(root_1, stream_decllist.nextTree());
+ adaptor.addChild(root_1, stream_statlist.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (XTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "program"
+
+ // Delegated rules
+
+
+
+ public static final BitSet FOLLOW_ID_in_decl396 = new BitSet(new long[]{0x0000000008000000L});
+ public static final BitSet FOLLOW_27_in_decl398 = new BitSet(new long[]{0x0000089000000000L});
+ public static final BitSet FOLLOW_39_in_decl403 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_36_in_decl409 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_43_in_decl415 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_29_in_decl418 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_42_in_decl444 = new BitSet(new long[]{0x0000000000000200L});
+ public static final BitSet FOLLOW_ID_in_decl446 = new BitSet(new long[]{0x0000000008000000L});
+ public static final BitSet FOLLOW_27_in_decl448 = new BitSet(new long[]{0x0000089000000000L});
+ public static final BitSet FOLLOW_39_in_decl453 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_36_in_decl459 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_43_in_decl465 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_29_in_decl468 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_40_in_decl496 = new BitSet(new long[]{0x0000000000000200L});
+ public static final BitSet FOLLOW_ID_in_decl498 = new BitSet(new long[]{0x0000000008000000L});
+ public static final BitSet FOLLOW_27_in_decl500 = new BitSet(new long[]{0x0000089000000000L});
+ public static final BitSet FOLLOW_39_in_decl505 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_36_in_decl511 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_43_in_decl517 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_29_in_decl520 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_42_in_decl548 = new BitSet(new long[]{0x0000010000000000L});
+ public static final BitSet FOLLOW_40_in_decl550 = new BitSet(new long[]{0x0000000000000200L});
+ public static final BitSet FOLLOW_ID_in_decl552 = new BitSet(new long[]{0x0000000008000000L});
+ public static final BitSet FOLLOW_27_in_decl554 = new BitSet(new long[]{0x0000089000000000L});
+ public static final BitSet FOLLOW_39_in_decl559 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_36_in_decl565 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_43_in_decl571 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_29_in_decl574 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_decl_in_decllist600 = new BitSet(new long[]{0x0000050000000202L});
+ public static final BitSet FOLLOW_multexpr_in_expr627 = new BitSet(new long[]{0x0000000001800002L});
+ public static final BitSet FOLLOW_23_in_expr631 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_24_in_expr636 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_multexpr_in_expr640 = new BitSet(new long[]{0x0000000001800002L});
+ public static final BitSet FOLLOW_simpleexpr_in_multexpr651 = new BitSet(new long[]{0x0000000004400002L});
+ public static final BitSet FOLLOW_22_in_multexpr655 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_26_in_multexpr660 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_simpleexpr_in_multexpr664 = new BitSet(new long[]{0x0000000004400002L});
+ public static final BitSet FOLLOW_20_in_simpleexpr674 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_expr_in_simpleexpr677 = new BitSet(new long[]{0x0000000000200000L});
+ public static final BitSet FOLLOW_21_in_simpleexpr679 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_INTCONST_in_simpleexpr697 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_24_in_simpleexpr701 = new BitSet(new long[]{0x0000000000000400L});
+ public static final BitSet FOLLOW_INTCONST_in_simpleexpr703 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_FLOATCONST_in_simpleexpr727 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_24_in_simpleexpr731 = new BitSet(new long[]{0x0000000000000100L});
+ public static final BitSet FOLLOW_FLOATCONST_in_simpleexpr733 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ID_in_simpleexpr757 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRINGCONST_in_simpleexpr761 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ID_in_assignstat771 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_28_in_assignstat773 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_expr_in_assignstat776 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr_in_cond792 = new BitSet(new long[]{0x00000001C0000000L});
+ public static final BitSet FOLLOW_30_in_cond795 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_32_in_cond799 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_31_in_cond803 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_expr_in_cond808 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_38_in_condstat820 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_cond_in_condstat823 = new BitSet(new long[]{0x0000100000000000L});
+ public static final BitSet FOLLOW_44_in_condstat825 = new BitSet(new long[]{0x0000206200000200L});
+ public static final BitSet FOLLOW_stat_in_condstat828 = new BitSet(new long[]{0x0000000400000002L});
+ public static final BitSet FOLLOW_34_in_condstat840 = new BitSet(new long[]{0x0000206200000200L});
+ public static final BitSet FOLLOW_stat_in_condstat843 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_45_in_whilestat856 = new BitSet(new long[]{0x0000000000100000L});
+ public static final BitSet FOLLOW_20_in_whilestat858 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_cond_in_whilestat860 = new BitSet(new long[]{0x0000000000200000L});
+ public static final BitSet FOLLOW_21_in_whilestat862 = new BitSet(new long[]{0x0000206200000200L});
+ public static final BitSet FOLLOW_stat_in_whilestat864 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_37_in_forstat885 = new BitSet(new long[]{0x0000000000100000L});
+ public static final BitSet FOLLOW_20_in_forstat888 = new BitSet(new long[]{0x0000000000000200L});
+ public static final BitSet FOLLOW_assignstat_in_forstat891 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_29_in_forstat893 = new BitSet(new long[]{0x0000000001110700L});
+ public static final BitSet FOLLOW_cond_in_forstat896 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_29_in_forstat898 = new BitSet(new long[]{0x0000000000000200L});
+ public static final BitSet FOLLOW_assignstat_in_forstat901 = new BitSet(new long[]{0x0000000000200000L});
+ public static final BitSet FOLLOW_21_in_forstat903 = new BitSet(new long[]{0x0000206200000200L});
+ public static final BitSet FOLLOW_stat_in_forstat906 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_assignstat_in_stat922 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_condstat_in_stat926 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_whilestat_in_stat930 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_forstat_in_stat934 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_statlist_in_stat938 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_33_in_statlist952 = new BitSet(new long[]{0x0000206A00000200L});
+ public static final BitSet FOLLOW_stat_in_statlist955 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_29_in_statlist957 = new BitSet(new long[]{0x0000206A00000200L});
+ public static final BitSet FOLLOW_35_in_statlist961 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_41_in_program984 = new BitSet(new long[]{0x0000000000000200L});
+ public static final BitSet FOLLOW_ID_in_program986 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_29_in_program988 = new BitSet(new long[]{0x0000050200000200L});
+ public static final BitSet FOLLOW_decllist_in_program990 = new BitSet(new long[]{0x0000000200000000L});
+ public static final BitSet FOLLOW_statlist_in_program992 = new BitSet(new long[]{0x0000000002000000L});
+ public static final BitSet FOLLOW_25_in_program994 = new BitSet(new long[]{0x0000000000000000L});
+ public static final BitSet FOLLOW_EOF_in_program996 = new BitSet(new long[]{0x0000000000000002L});
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTree.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTree.java
new file mode 100644
index 0000000..1f0cf21
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTree.java
@@ -0,0 +1,32 @@
+package de.dhbw.compiler.antlrxcompiler;
+
+import org.antlr.runtime.Token;
+import org.antlr.runtime.tree.CommonTree;
+
+
+public class XTree extends CommonTree {
+
+ public XType exprType = XType.NoType;
+
+ public XTree() {
+ super();
+ };
+
+ public XTree(Token t) {
+ super(t);
+ }
+
+ public XTree(CommonTree t ) {
+ super(t);
+ }
+
+ @Override
+ public String toString() {
+ String s = super.toString();
+ if (exprType!=XType.NoType) {
+ s+="<"+exprType+">";
+ }
+ return s;
+ }
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTreeAdaptor.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTreeAdaptor.java
new file mode 100644
index 0000000..e0ca034
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTreeAdaptor.java
@@ -0,0 +1,46 @@
+package de.dhbw.compiler.antlrxcompiler;
+
+import org.antlr.runtime.CommonToken;
+import org.antlr.runtime.Token;
+import org.antlr.runtime.tree.CommonTreeAdaptor;
+
+
+public class XTreeAdaptor extends CommonTreeAdaptor {
+
+ @Override
+ public Object create(Token token) {
+ return new XTree(token);
+ }
+
+ @Override
+ public Object dupNode(Object t) {
+ if ( t==null ) {
+ return null;
+ }
+ return create(((XTree)t).token);
+ }
+
+ @Override
+ public Object create(int tokenType, String text) {
+ return create(tokenType, null, text);
+ }
+
+ @Override
+ public Object create(int tokenType, Token fromToken) {
+ return create(tokenType, fromToken, null);
+ }
+
+ @Override
+ public Object create(int tokenType, Token fromToken, String text) {
+ if (fromToken==null) {
+ fromToken = new CommonToken(tokenType, text);
+ } else {
+ fromToken.setType(tokenType);
+ fromToken.setText(text);
+ }
+ return new XTree(fromToken);
+ }
+
+
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XType.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XType.java
new file mode 100644
index 0000000..3f62109
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XType.java
@@ -0,0 +1,16 @@
+package de.dhbw.compiler.antlrxcompiler;
+
+public enum XType {
+ NoType, InvalidType, IntType, FloatType, StringType;
+
+ public String toString() {
+ switch (this) {
+ case InvalidType: return "invalid";
+ case IntType: return "int";
+ case FloatType: return "float";
+ case StringType: return "string";
+ default: return "";
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.g b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.g
new file mode 100644
index 0000000..a4d063c
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.g
@@ -0,0 +1,28 @@
+tree grammar XTypeCheck;
+
+options {
+ language = Java;
+ output = AST;
+ tokenVocab = X;
+ ASTLabelType = XTree;
+}
+
+tokens{
+ PLUS='+';
+}
+
+@header {
+package de.dhbw.compiler.antlrxcompiler;
+
+import java.util.HashMap;
+}
+
+@members {
+
+ private SymbolTable symbols = SymbolTable.getInstance();
+
+}
+
+
+program: 'todo';
+
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.java
new file mode 100644
index 0000000..b7eb887
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.java
@@ -0,0 +1,162 @@
+// $ANTLR 3.5.2 /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.g 2020-06-10 10:16:11
+
+package de.dhbw.compiler.antlrxcompiler;
+
+import java.util.HashMap;
+
+
+import org.antlr.runtime.*;
+import org.antlr.runtime.tree.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+
+@SuppressWarnings("all")
+public class XTypeCheck extends TreeParser {
+ public static final String[] tokenNames = new String[] {
+ "", "", "", "", "COMMENT", "DECL", "DECLLIST",
+ "DIGIT", "FLOATCONST", "ID", "INTCONST", "INVALID", "LETTER", "OTHER",
+ "POSDIGIT", "STATLIST", "STRINGCONST", "UMINUS", "WS", "ZERO", "'('",
+ "')'", "'*'", "'+'", "'-'", "'.'", "'/'", "':'", "':='", "';'", "'<'",
+ "'='", "'>'", "'begin'", "'else'", "'end'", "'float'", "'for'", "'if'",
+ "'int'", "'print'", "'program'", "'read'", "'string'", "'then'", "'while'",
+ "'todo'"
+ };
+ public static final int EOF=-1;
+ public static final int T__20=20;
+ public static final int T__21=21;
+ public static final int T__22=22;
+ public static final int T__23=23;
+ public static final int T__24=24;
+ public static final int T__25=25;
+ public static final int T__26=26;
+ public static final int T__27=27;
+ public static final int T__28=28;
+ public static final int T__29=29;
+ public static final int T__30=30;
+ public static final int T__31=31;
+ public static final int T__32=32;
+ public static final int T__33=33;
+ public static final int T__34=34;
+ public static final int T__35=35;
+ public static final int T__36=36;
+ public static final int T__37=37;
+ public static final int T__38=38;
+ public static final int T__39=39;
+ public static final int T__40=40;
+ public static final int T__41=41;
+ public static final int T__42=42;
+ public static final int T__43=43;
+ public static final int T__44=44;
+ public static final int T__45=45;
+ public static final int COMMENT=4;
+ public static final int DECL=5;
+ public static final int DECLLIST=6;
+ public static final int DIGIT=7;
+ public static final int FLOATCONST=8;
+ public static final int ID=9;
+ public static final int INTCONST=10;
+ public static final int INVALID=11;
+ public static final int LETTER=12;
+ public static final int OTHER=13;
+ public static final int POSDIGIT=14;
+ public static final int STATLIST=15;
+ public static final int STRINGCONST=16;
+ public static final int UMINUS=17;
+ public static final int WS=18;
+ public static final int ZERO=19;
+ public static final int T__46=46;
+ public static final int PLUS=23;
+
+ // delegates
+ public TreeParser[] getDelegates() {
+ return new TreeParser[] {};
+ }
+
+ // delegators
+
+
+ public XTypeCheck(TreeNodeStream input) {
+ this(input, new RecognizerSharedState());
+ }
+ public XTypeCheck(TreeNodeStream input, RecognizerSharedState state) {
+ super(input, state);
+ }
+
+ protected TreeAdaptor adaptor = new CommonTreeAdaptor();
+
+ public void setTreeAdaptor(TreeAdaptor adaptor) {
+ this.adaptor = adaptor;
+ }
+ public TreeAdaptor getTreeAdaptor() {
+ return adaptor;
+ }
+ @Override public String[] getTokenNames() { return XTypeCheck.tokenNames; }
+ @Override public String getGrammarFileName() { return "/Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.g"; }
+
+
+
+ private SymbolTable symbols = SymbolTable.getInstance();
+
+
+
+ public static class program_return extends TreeRuleReturnScope {
+ XTree tree;
+ @Override
+ public XTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "program"
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.g:27:1: program : 'todo' ;
+ public final XTypeCheck.program_return program() throws RecognitionException {
+ XTypeCheck.program_return retval = new XTypeCheck.program_return();
+ retval.start = input.LT(1);
+
+ XTree root_0 = null;
+
+ XTree _first_0 = null;
+ XTree _last = null;
+
+
+ XTree string_literal1=null;
+
+ XTree string_literal1_tree=null;
+
+ try {
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.g:27:8: ( 'todo' )
+ // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.g:27:15: 'todo'
+ {
+ root_0 = (XTree)adaptor.nil();
+
+
+ _last = (XTree)input.LT(1);
+ string_literal1=(XTree)match(input,46,FOLLOW_46_in_program82);
+ string_literal1_tree = (XTree)adaptor.dupNode(string_literal1);
+
+
+ adaptor.addChild(root_0, string_literal1_tree);
+
+ }
+
+ retval.tree = (XTree)adaptor.rulePostProcessing(root_0);
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "program"
+
+ // Delegated rules
+
+
+
+ public static final BitSet FOLLOW_46_in_program82 = new BitSet(new long[]{0x0000000000000002L});
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.tokens b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.tokens
new file mode 100644
index 0000000..c292af2
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XTypeCheck.tokens
@@ -0,0 +1,71 @@
+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
+T__46=46
+PLUS=23
+'('=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
+'todo'=46
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XtoJava.g b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XtoJava.g
new file mode 100644
index 0000000..46c4efb
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XtoJava.g
@@ -0,0 +1,21 @@
+tree grammar XtoJava;
+
+options {
+ language = Java;
+ output = template;
+ tokenVocab = XOptimizer;
+ ASTLabelType = XTree;
+}
+
+@header {
+ package de.dhbw.compiler.antlrxcompiler;
+}
+
+@members {
+
+ private SymbolTable symbols = SymbolTable.getInstance();
+
+}
+
+program: 'todo' -> template() "Hello World!";
+
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XtoJava.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XtoJava.java
new file mode 100644
index 0000000..9e154ac
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XtoJava.java
@@ -0,0 +1,160 @@
+// $ANTLR 3.5.2 C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XtoJava.g 2019-05-23 12:03:27
+
+ package de.dhbw.compiler.antlrxcompiler;
+
+
+import org.antlr.runtime.*;
+import org.antlr.runtime.tree.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.antlr.stringtemplate.*;
+import org.antlr.stringtemplate.language.*;
+import java.util.HashMap;
+@SuppressWarnings("all")
+public class XtoJava extends TreeParser {
+ public static final String[] tokenNames = new String[] {
+ "", "", "", "", "COMMENT", "DECL", "DECLLIST",
+ "DIGIT", "FLOATCONST", "ID", "INTCONST", "INVALID", "LETTER", "OTHER",
+ "POSDIGIT", "STATLIST", "STRINGCONST", "UMINUS", "WS", "ZERO", "'('",
+ "')'", "'*'", "'+'", "'-'", "'.'", "'/'", "':'", "':='", "';'", "'<'",
+ "'='", "'>'", "'begin'", "'else'", "'end'", "'float'", "'for'", "'if'",
+ "'int'", "'print'", "'program'", "'read'", "'string'", "'then'", "'while'",
+ "'todo'"
+ };
+ public static final int EOF=-1;
+ public static final int T__20=20;
+ public static final int T__21=21;
+ public static final int T__22=22;
+ public static final int T__23=23;
+ public static final int T__24=24;
+ public static final int T__25=25;
+ public static final int T__26=26;
+ public static final int T__27=27;
+ public static final int T__28=28;
+ public static final int T__29=29;
+ public static final int T__30=30;
+ public static final int T__31=31;
+ public static final int T__32=32;
+ public static final int T__33=33;
+ public static final int T__34=34;
+ public static final int T__35=35;
+ public static final int T__36=36;
+ public static final int T__37=37;
+ public static final int T__38=38;
+ public static final int T__39=39;
+ public static final int T__40=40;
+ public static final int T__41=41;
+ public static final int T__42=42;
+ public static final int T__43=43;
+ public static final int T__44=44;
+ public static final int T__45=45;
+ public static final int COMMENT=4;
+ public static final int DECL=5;
+ public static final int DECLLIST=6;
+ public static final int DIGIT=7;
+ public static final int FLOATCONST=8;
+ public static final int ID=9;
+ public static final int INTCONST=10;
+ public static final int INVALID=11;
+ public static final int LETTER=12;
+ public static final int OTHER=13;
+ public static final int POSDIGIT=14;
+ public static final int STATLIST=15;
+ public static final int STRINGCONST=16;
+ public static final int UMINUS=17;
+ public static final int WS=18;
+ public static final int ZERO=19;
+ public static final int T__46=46;
+ public static final int PLUS=23;
+
+ // delegates
+ public TreeParser[] getDelegates() {
+ return new TreeParser[] {};
+ }
+
+ // delegators
+
+
+ public XtoJava(TreeNodeStream input) {
+ this(input, new RecognizerSharedState());
+ }
+ public XtoJava(TreeNodeStream input, RecognizerSharedState state) {
+ super(input, state);
+ }
+
+ protected StringTemplateGroup templateLib =
+ new StringTemplateGroup("XtoJavaTemplates", AngleBracketTemplateLexer.class);
+
+ public void setTemplateLib(StringTemplateGroup templateLib) {
+ this.templateLib = templateLib;
+ }
+ public StringTemplateGroup getTemplateLib() {
+ return templateLib;
+ }
+ /** allows convenient multi-value initialization:
+ * "new STAttrMap().put(...).put(...)"
+ */
+ @SuppressWarnings("serial")
+ public static class STAttrMap extends HashMap {
+ public STAttrMap put(String attrName, Object value) {
+ super.put(attrName, value);
+ return this;
+ }
+ }
+ @Override public String[] getTokenNames() { return XtoJava.tokenNames; }
+ @Override public String getGrammarFileName() { return "C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XtoJava.g"; }
+
+
+
+ private SymbolTable symbols = SymbolTable.getInstance();
+
+
+
+ public static class program_return extends TreeRuleReturnScope {
+ public StringTemplate st;
+ public Object getTemplate() { return st; }
+ public String toString() { return st==null?null:st.toString(); }
+ };
+
+
+ // $ANTLR start "program"
+ // C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XtoJava.g:20:1: program : 'todo' -> template( \"Hello World!\";
+ public final XtoJava.program_return program() throws RecognitionException {
+ XtoJava.program_return retval = new XtoJava.program_return();
+ retval.start = input.LT(1);
+
+ try {
+ // C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XtoJava.g:20:8: ( 'todo' -> template( \"Hello World!\")
+ // C:\\Users\\eisenbiegler\\Dropbox\\workspace_cc\\CC-Praxis-Antlr X Uebersetzer-Leer\\src\\de\\dhbw\\compiler\\antlrxcompiler\\XtoJava.g:20:15: 'todo'
+ {
+ match(input,46,FOLLOW_46_in_program69);
+ // TEMPLATE REWRITE
+ // 20:22: -> template( \"Hello World!\"
+ {
+ retval.st = new StringTemplate(templateLib, "Hello World!");
+ }
+
+
+
+ }
+
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "program"
+
+ // Delegated rules
+
+
+
+ public static final BitSet FOLLOW_46_in_program69 = new BitSet(new long[]{0x0000000000000002L});
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XtoJava.tokens b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XtoJava.tokens
new file mode 100644
index 0000000..c292af2
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/XtoJava.tokens
@@ -0,0 +1,71 @@
+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
+T__46=46
+PLUS=23
+'('=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
+'todo'=46
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/OptimizerTest.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/OptimizerTest.java
new file mode 100644
index 0000000..afa4cee
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/OptimizerTest.java
@@ -0,0 +1,51 @@
+/* **********************************************
+ * Duale Hochschule Baden-Württemberg Karlsruhe
+ * Prof. Dr. Jörn Eisenbiegler
+ *
+ * Vorlesung Übersetzerbau
+ * Praxis ANTLR-Parser für X
+ * - Testfall-Utility für Parser
+ *
+ * **********************************************
+ */
+
+
+package de.dhbw.compiler.antlrxcompiler.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayInputStream;
+
+import org.antlr.runtime.ANTLRInputStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.tree.CommonTreeNodeStream;
+
+import de.dhbw.compiler.antlrxcompiler.XLexer;
+import de.dhbw.compiler.antlrxcompiler.XOptimizer;
+import de.dhbw.compiler.antlrxcompiler.XParser;
+import de.dhbw.compiler.antlrxcompiler.XTree;
+import de.dhbw.compiler.antlrxcompiler.XTreeAdaptor;
+import de.dhbw.compiler.antlrxcompiler.XTypeCheck;
+
+public abstract class OptimizerTest {
+
+ protected void testTypeCheckTree(String in, String expected) throws Exception {
+ XTreeAdaptor xTreeAdaptor = new XTreeAdaptor();
+ ANTLRInputStream input = new ANTLRInputStream(new ByteArrayInputStream(in.getBytes()));
+ XLexer scanner = new XLexer(input);
+ CommonTokenStream tokens = new CommonTokenStream(scanner);
+ XParser parser = new XParser(tokens);
+ parser.setTreeAdaptor(xTreeAdaptor);
+ XTree out = parser.program().getTree();
+ XOptimizer optimizer = new XOptimizer(new CommonTreeNodeStream(xTreeAdaptor, out));
+ optimizer.setTreeAdaptor(xTreeAdaptor);
+ out = (XTree)optimizer.downup(out,true);
+
+ if (out==null) {
+ assertEquals(expected, out);
+ } else {
+ assertEquals(expected, out.toStringTree());
+ }
+ }
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/ParseTreeTest.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/ParseTreeTest.java
new file mode 100644
index 0000000..9f9b3b0
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/ParseTreeTest.java
@@ -0,0 +1,46 @@
+/* **********************************************
+ * Duale Hochschule Baden-Württemberg Karlsruhe
+ * Prof. Dr. Jörn Eisenbiegler
+ *
+ * Vorlesung Übersetzerbau
+ * Praxis ANTLR-Parser für X
+ * - Testfall-Utility für Parser
+ *
+ * **********************************************
+ */
+
+
+package de.dhbw.compiler.antlrxcompiler.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayInputStream;
+
+import org.antlr.runtime.ANTLRInputStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.ParserRuleReturnScope;
+import org.antlr.runtime.tree.CommonTree;
+
+import de.dhbw.compiler.antlrxcompiler.XLexer;
+import de.dhbw.compiler.antlrxcompiler.XParser;
+import de.dhbw.compiler.antlrxcompiler.XTreeAdaptor;
+
+public abstract class ParseTreeTest {
+
+ protected void testParseTree(String in, String expected) throws Exception {
+ ANTLRInputStream input = new ANTLRInputStream(new ByteArrayInputStream(in.getBytes()));
+ XLexer scanner = new XLexer(input);
+ CommonTokenStream tokens = new CommonTokenStream(scanner);
+ XParser parser = new XParser(tokens);
+ parser.setTreeAdaptor(new XTreeAdaptor());
+ ParserRuleReturnScope result = parser.program();
+ CommonTree out = (CommonTree) result.getTree();
+
+ if (out==null) {
+ assertEquals(expected, out);
+ } else {
+ assertEquals(expected, out.toStringTree());
+ }
+ }
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXOptimizer.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXOptimizer.java
new file mode 100644
index 0000000..68a5ee3
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXOptimizer.java
@@ -0,0 +1,23 @@
+/* **********************************************
+ * Duale Hochschule Baden-Württemberg Karlsruhe
+ * Prof. Dr. Jörn Eisenbiegler
+ *
+ * Vorlesung Übersetzerbau
+ * Praxis ANTLR-Parser für X
+ * - Testsuite für Typ-Pr�fung
+ *
+ * **********************************************
+ */
+package de.dhbw.compiler.antlrxcompiler.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ TestAntlrXScanner1.class, TestAntlrXScanner2.class, TestAntlrXScanner3.class,
+ TestAntlrXParser1.class, TestAntlrXParser2.class,
+ TestAntlrXOptimizer1.class})
+public class TestAntlrXOptimizer {
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXOptimizer1.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXOptimizer1.java
new file mode 100644
index 0000000..d772780
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXOptimizer1.java
@@ -0,0 +1,401 @@
+/* **********************************************
+ * Duale Hochschule Baden-Württemberg Karlsruhe
+ * Prof. Dr. Jörn Eisenbiegler
+ *
+ * Vorlesung Übersetzerbau
+ * Praxis ANTLR-Parser für X
+ * - Testf�lle für Optimierer
+ *
+ * **********************************************
+ */
+
+package de.dhbw.compiler.antlrxcompiler.test;
+
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestAntlrXOptimizer1 extends OptimizerTest {
+
+ @Test
+ public void optimize00() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : int;\n"+
+ "begin\n"+
+ " x:=0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize01() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : int;\n"+
+ "begin\n"+
+ " x:=1+2;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x 3)))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void optimize02() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : int;\n"+
+ "begin\n"+
+ " x:=1-2;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x -1)))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void optimize03() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : int;\n"+
+ "begin\n"+
+ " x:=1*2;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x 2)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize04() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : int;\n"+
+ "begin\n"+
+ " x:=1/2;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize05() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : int;\n"+
+ "begin\n"+
+ " x:=1+-2;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x -1)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize06() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : int;\n"+
+ "begin\n"+
+ " x:=1+12*(4-5)/6+7-(8+-9);\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x 7)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize10() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=0.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 0.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize11() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0+2.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 3.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void optimize12() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0-2.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x -1.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void optimize13() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0*2.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 2.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize14() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0/2.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 0.5)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize15() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0+-2.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x -1.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize16() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0+12.0*(4.0-5.0)/6.0+7.0-(8.0+-9.0);\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 7.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize30() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1+2.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 3.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize31() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0+2;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 3.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize32() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1-2.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x -1.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize33() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0-2;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x -1.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize34() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1*2.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 2.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize35() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0*2;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 2.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize36() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1/2.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 0.5)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize37() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0/2;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 0.5)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize38() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ "begin\n"+
+ " x:=1.0+12*(4.0-5)/6.0+7-(8.0+-9);\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 7.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize40() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ " y : int;\n"+
+ "begin\n"+
+ " x:=1+y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y int)) (STATLIST (:= x (+ 1 y))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize41() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ " y : int;\n"+
+ "begin\n"+
+ " x:=1+3+y+5*6;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y int)) (STATLIST (:= x (+ (+ 4 y) 30))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize50() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ " y : int;\n"+
+ "begin\n"+
+ " x:=0*y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y int)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize51() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ " y : int;\n"+
+ "begin\n"+
+ " x:=y*0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y int)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize52() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ " y : int;\n"+
+ "begin\n"+
+ " x:=(1+y)*0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y int)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize53() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ " y : int;\n"+
+ "begin\n"+
+ " x:=0*(1-y);\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y int)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize54() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ " y : int;\n"+
+ "begin\n"+
+ " x:=(1*y)*0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y int)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void optimize55() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x : float;\n"+
+ " y : int;\n"+
+ "begin\n"+
+ " x:=0*(1/y);\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y int)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program90Xmin1() throws Exception {
+ String test = "program xmin1;\n"+
+ " read x : int;\n"+
+ " print y : int;\n"+
+ "begin\n"+
+ " y := 25+2*x-6*x;\n"+
+ " if x3 then x:=1 else x:=2;"+
+ "end.";
+ String expected = "(program condElse (DECLLIST (DECL x int)) (STATLIST (if (> 2 3) (:= x 1) (:= x 2))))";
+ testParseTree(test, expected);
+ }
+
+ @Test
+ public void program22CondElse2() throws Exception {
+ String test = "program condelse2;\n"+
+ " x: int;"+
+ "begin\n"+
+ " if 2=3 then if 4<5 then x:=1 else x:=2 else x:=3;"+
+ "end.";
+ String expected = "(program condelse2 (DECLLIST (DECL x int)) "
+ + "(STATLIST (if (= 2 3) (if (< 4 5) (:= x 1) (:= x 2)) (:= x 3))))";
+ testParseTree(test, expected);
+ }
+
+
+ @Test
+ public void program23CondElse3() throws Exception {
+ String test = "program condelse3;\n"+
+ " x: int;"+
+ "begin\n"+
+ " if 2<3 then if 4>5 then x:=1 else if 6=7 then x:=2 else x:=3;"+
+ "end.";
+ String expected = "(program condelse3 (DECLLIST (DECL x int)) "
+ + "(STATLIST (if (< 2 3) (if (> 4 5) (:= x 1) (if (= 6 7) (:= x 2) (:= x 3))))))";
+ testParseTree(test, expected);
+ }
+
+
+ @Test
+ public void program24CondElse4() throws Exception {
+ String test = "program condelse4;\n"+
+ " x: int;"+
+ "begin\n"+
+ " if 2<3 then if 4>5 then x:=1 else x:=2 else if 6=7 then x:=3 else x:=4;"+
+ "end.";
+ String expected = "(program condelse4 (DECLLIST (DECL x int)) "
+ + "(STATLIST (if (< 2 3) (if (> 4 5) (:= x 1) (:= x 2)) (if (= 6 7) (:= x 3) (:= x 4)))))";
+ testParseTree(test, expected);
+ }
+
+
+ @Test
+ public void program90Xmin1() throws Exception {
+ String test = "program xmin1;\n"+
+ " read x : int;\n"+
+ " print y : int;\n"+
+ "begin\n"+
+ " y := 25+2*x-6*x;\n"+
+ " if x ", false, new TestToken(getType(">"),">",1,3));
+ }
+
+ @Test
+ public void tokenBEGIN() throws Exception {
+ testTokenList(" begin ", false, new TestToken(getType("BEGIN"),"begin",1,3));
+ }
+
+ @Test
+ public void tokenELSE() throws Exception {
+ testTokenList(" else ", false, new TestToken(getType("ELSE"),"else",1,3));
+ }
+
+ @Test
+ public void tokenEND() throws Exception {
+ testTokenList(" end ", false, new TestToken(getType("END"),"end",1,3));
+ }
+
+ @Test
+ public void tokenFLOAT() throws Exception {
+ testTokenList(" float ", false, new TestToken(getType("FLOAT"),"float",1,3));
+ }
+
+ @Test
+ public void tokenFOR() throws Exception {
+ testTokenList(" for ", false, new TestToken(getType("FOR"),"for",1,3));
+ }
+
+ @Test
+ public void tokenIF() throws Exception {
+ testTokenList(" if ", false, new TestToken(getType("IF"),"if",1,3));
+ }
+
+ @Test
+ public void tokenINT() throws Exception {
+ testTokenList(" int ", false, new TestToken(getType("INT"),"int",1,3));
+ }
+
+ @Test
+ public void tokenPRINT() throws Exception {
+ testTokenList(" print ", false, new TestToken(getType("PRINT"),"print",1,3));
+ }
+
+ @Test
+ public void tokenPROGRAM() throws Exception {
+ testTokenList(" program ", false, new TestToken(getType("PROGRAM"),"program",1,3));
+ }
+
+ @Test
+ public void tokenREAD() throws Exception {
+ testTokenList(" read ", false, new TestToken(getType("READ"),"read",1,3));
+ }
+
+ @Test
+ public void tokenSTRING() throws Exception {
+ testTokenList(" string ", false, new TestToken(getType("STRING"),"string",1,3));
+ }
+
+ @Test
+ public void tokenTHEN() throws Exception {
+ testTokenList(" then ", false, new TestToken(getType("THEN"),"then",1,3));
+ }
+
+ @Test
+ public void tokenWHILE() throws Exception {
+ testTokenList(" while ", false, new TestToken(getType("WHILE"),"while",1,3));
+ }
+
+ @Test
+ public void tokenEOF() throws Exception {
+ testTokenList(" ", false);
+ testTokenList(" ", false, new TestToken(-1,"",1,2));
+ testTokenList("", false, new TestToken(-1,"",1,1));
+ }
+
+ @Test
+ public void invalidÄ() throws Exception {
+ testTokenList(" Ä ", false, new TestToken(getType("INVALID"),"Ä",1,2));
+ }
+
+ @Test
+ public void invalidGatter() throws Exception {
+ testTokenList(" # ", false, new TestToken(getType("INVALID"),"#",1,2));
+ }
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXScanner2.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXScanner2.java
new file mode 100644
index 0000000..0c96e35
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXScanner2.java
@@ -0,0 +1,66 @@
+/* **********************************************
+ * Duale Hochschule Baden-Württemberg Karlsruhe
+ * Prof. Dr. Jörn Eisenbiegler
+ *
+ * Vorlesung Übersetzerbau
+ * Praxis ANTLR-Parser für X
+ * - Testf�lle für Scanner 2
+ *
+ * **********************************************
+ */
+
+package de.dhbw.compiler.antlrxcompiler.test;
+
+import org.junit.Test;
+
+public class TestAntlrXScanner2 extends TokenStreamTest {
+
+ @Test
+ public void tokenIntConst() throws Exception {
+ testTokenList(" 0 ", true, new TestToken(getType("INTCONST"),"0",1,3));
+ testTokenList(" 1 ", true, new TestToken(getType("INTCONST"),"1",1,3));
+ testTokenList(" 12 ", true, new TestToken(getType("INTCONST"),"12",1,3));
+ testTokenList(" 123 ", true, new TestToken(getType("INTCONST"),"123",1,3));
+ testTokenList(" 1234567890 ", true, new TestToken(getType("INTCONST"),"1234567890",1,3));
+ testTokenList(" 78 ", true, new TestToken(getType("INTCONST"),"78",1,3));
+ }
+
+ @Test
+ public void tokenFloatConst0() throws Exception {
+ testTokenList(" 0. ", true, new TestToken(getType("FLOATCONST"),"0.",1,3));
+ testTokenList(" 0.0 ", true, new TestToken(getType("FLOATCONST"),"0.0",1,3));
+ testTokenList(" 0.0e0 ", true, new TestToken(getType("FLOATCONST"),"0.0e0",1,3));
+ }
+
+ @Test
+ public void tokenFloatConst1() throws Exception {
+ testTokenList(" 1. ", true, new TestToken(getType("FLOATCONST"),"1.",1,3));
+ testTokenList(" 1.1 ", true, new TestToken(getType("FLOATCONST"),"1.1",1,3));
+ testTokenList(" 1.1e1 ", true, new TestToken(getType("FLOATCONST"),"1.1e1",1,3));
+ testTokenList(" 1e1 ", true, new TestToken(getType("FLOATCONST"),"1e1",1,3));
+ }
+
+ @Test
+ public void tokenFloatConst123() throws Exception {
+ testTokenList(" 0.12e34 ", true, new TestToken(getType("FLOATCONST"),"0.12e34",1,3));
+ testTokenList(" 0.045e23 ", true, new TestToken(getType("FLOATCONST"),"0.045e23",1,3));
+ testTokenList(" 123.4560e7890 ", true, new TestToken(getType("FLOATCONST"),"123.4560e7890",1,3));
+ testTokenList(" 0.12E34 ", true, new TestToken(getType("FLOATCONST"),"0.12E34",1,3));
+ testTokenList(" 0.045E23 ", true, new TestToken(getType("FLOATCONST"),"0.045E23",1,3));
+ testTokenList(" 123.4560E7890 ", true, new TestToken(getType("FLOATCONST"),"123.4560E7890",1,3));
+ }
+
+ @Test
+ public void tokenStringConst() throws Exception {
+ testTokenList(" \"hallo .: \" ", true, new TestToken(getType("STRINGCONST"),"\"hallo .: \"",1,3));
+ testTokenList(" \" \\\" \" ", true, new TestToken(getType("STRINGCONST"),"\" \\\" \"",1,3));
+ /*
+ testTokenList(" \"hallo , \" ", true,
+ new TestToken(getType("INVALID"),"\"hallo ",1,3),
+ new TestToken(getType("INVALID"),"\" ",1,12));
+ testTokenList(" \",\"", true,
+ new TestToken(getType("INVALID"),"\"",1,3),
+ new TestToken(getType("INVALID"),"\"",1,5)); */
+ }
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXScanner3.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXScanner3.java
new file mode 100644
index 0000000..44b9d47
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXScanner3.java
@@ -0,0 +1,110 @@
+/* **********************************************
+ * Duale Hochschule Baden-Württemberg Karlsruhe
+ * Prof. Dr. Jörn Eisenbiegler
+ *
+ * Vorlesung Übersetzerbau
+ * Praxis ANTLR-Parser für X
+ * - Testf�lle für Scanner 3
+ *
+ * **********************************************
+ */
+
+package de.dhbw.compiler.antlrxcompiler.test;
+
+import org.junit.Test;
+
+public class TestAntlrXScanner3 extends TokenStreamTest {
+
+ @Test
+ public void program1() throws Exception {
+ testTokenList("program test1;\nbegin\nend.",false,
+ new TestToken(getType("PROGRAM"),"program",1,1),
+ new TestToken(getType("ID"),"test1",1,9),
+ new TestToken(getType(";"),";",1,14),
+ new TestToken(getType("BEGIN"),"begin",2,1),
+ new TestToken(getType("END"),"end",3,1),
+ new TestToken(getType("."),".",3,4));
+ }
+
+ @Test
+ public void program2() throws Exception {
+ testTokenList( "program test2;\n"+
+ " x : int;\n"+
+ " y : float;\n"+
+ " z : string;\n"+
+ "begin\n"+
+ " x := 4+5+6.2;\n"+
+ " y := 3.56+1.2e3+45.e-67+4e34+3E-1;\n"+
+ " z := \"Hello \\\"World\\\"\" + \":\";\n"+
+ " z := \"Peter\" + 4;\n"+
+ " a := 3+4;\n"+
+ "end.", false,
+ // program test2;
+ new TestToken(getType("PROGRAM"),"program",1,1),
+ new TestToken(getType("ID"),"test2",1,9),
+ new TestToken(getType(";"),";",1,14),
+ // x : int;
+ new TestToken(getType("ID"),"x",2,2),
+ new TestToken(getType(":"),":",2,4),
+ new TestToken(getType("INT"),"int",2,6),
+ new TestToken(getType(";"),";",2,9),
+ // y : float;
+ new TestToken(getType("ID"),"y",3,2),
+ new TestToken(getType(":"),":",3,4),
+ new TestToken(getType("FLOAT"),"float",3,6),
+ new TestToken(getType(";"),";",3,11),
+ // z : string;
+ new TestToken(getType("ID"),"z",4,2),
+ new TestToken(getType(":"),":",4,4),
+ new TestToken(getType("STRING"),"string",4,6),
+ new TestToken(getType(";"),";",4,12),
+ // begin
+ new TestToken(getType("BEGIN"),"begin",5,1),
+ // x := 4+5+6.2;
+ new TestToken(getType("ID"),"x",6,2),
+ new TestToken(getType(":="),":=",6,4),
+ new TestToken(getType("INTCONST"),"4",6,7),
+ new TestToken(getType("+"),"+",6,8),
+ new TestToken(getType("INTCONST"),"5",6,9),
+ new TestToken(getType("+"),"+",6,10),
+ new TestToken(getType("FLOATCONST"),"6.2",6,11),
+ new TestToken(getType(";"),";",6,14),
+ // y := 3.56+1.2e3+45.e-67+4e34+3E-1;
+ new TestToken(getType("ID"),"y",7,2),
+ new TestToken(getType(":="),":=",7,4),
+ new TestToken(getType("FLOATCONST"),"3.56",7,7),
+ new TestToken(getType("+"),"+",7,11),
+ new TestToken(getType("FLOATCONST"),"1.2e3",7,12),
+ new TestToken(getType("+"),"+",7,17),
+ new TestToken(getType("FLOATCONST"),"45.e-67",7,18),
+ new TestToken(getType("+"),"+",7,25),
+ new TestToken(getType("FLOATCONST"),"4e34",7,26),
+ new TestToken(getType("+"),"+",7,30),
+ new TestToken(getType("FLOATCONST"),"3E-1",7,31),
+ new TestToken(getType(";"),";",7,35),
+ // z := \"Hello \\\"World\\\"\" + \":\";
+ new TestToken(getType("ID"),"z",8,2),
+ new TestToken(getType(":="),":=",8,4),
+ new TestToken(getType("STRINGCONST"),"\"Hello \\\"World\\\"\"",8,7),
+ new TestToken(getType("+"),"+",8,25),
+ new TestToken(getType("STRINGCONST"),"\":\"",8,27),
+ new TestToken(getType(";"),";",8,30),
+ // z := \"Peter\" + 4;
+ new TestToken(getType("ID"),"z",9,2),
+ new TestToken(getType(":="),":=",9,4),
+ new TestToken(getType("STRINGCONST"),"\"Peter\"",9,7),
+ new TestToken(getType("+"),"+",9,15),
+ new TestToken(getType("INTCONST"),"4",9,17),
+ new TestToken(getType(";"),";",9,18),
+ // a := 3+4;
+ new TestToken(getType("ID"),"a",10,2),
+ new TestToken(getType(":="),":=",10,4),
+ new TestToken(getType("INTCONST"),"3",10,7),
+ new TestToken(getType("+"),"+",10,8),
+ new TestToken(getType("INTCONST"),"4",10,9),
+ new TestToken(getType(";"),";",10,10),
+ // end.
+ new TestToken(getType("END"),"end",11,1),
+ new TestToken(getType("."),".",11,4));
+ }
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXTypeCheck.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXTypeCheck.java
new file mode 100644
index 0000000..991f1b4
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXTypeCheck.java
@@ -0,0 +1,23 @@
+/* **********************************************
+ * Duale Hochschule Baden-Württemberg Karlsruhe
+ * Prof. Dr. Jörn Eisenbiegler
+ *
+ * Vorlesung Übersetzerbau
+ * Praxis ANTLR-Parser für X
+ * - Testsuite für Typ-Pr�fung
+ *
+ * **********************************************
+ */
+package de.dhbw.compiler.antlrxcompiler.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ TestAntlrXScanner1.class, TestAntlrXScanner2.class, TestAntlrXScanner3.class,
+ TestAntlrXParser1.class, TestAntlrXParser2.class,
+ TestAntlrXTypeCheck1.class})
+public class TestAntlrXTypeCheck {
+
+}
diff --git a/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXTypeCheck1.java b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXTypeCheck1.java
new file mode 100644
index 0000000..e1e1f9d
--- /dev/null
+++ b/CC-Praxis-Antlr X Uebersetzer-Leer/src/de/dhbw/compiler/antlrxcompiler/test/TestAntlrXTypeCheck1.java
@@ -0,0 +1,488 @@
+/* **********************************************
+ * Duale Hochschule Baden-Württemberg Karlsruhe
+ * Prof. Dr. Jörn Eisenbiegler
+ *
+ * Vorlesung Übersetzerbau
+ * Praxis ANTLR-Parser für X
+ * - Testf�lle für Typ-Pr�fung
+ *
+ * **********************************************
+ */
+
+package de.dhbw.compiler.antlrxcompiler.test;
+
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestAntlrXTypeCheck1 extends TypeCheckTest {
+
+ @Test
+ public void typecheck00Undefined() throws Exception {
+ String test = "program beginEnd;\n"+
+ "begin\n"+
+ " x:=0;\n"+
+ "end.";
+ String expected = "(program beginEnd DECLLIST (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void typecheck11AssignIntValid1() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x:=0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck12AssignIntValid2() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: int;"+
+ " y: int;"+
+ "begin\n"+
+ " x:=y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int) (DECL y int)) (STATLIST (:= x y)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck13AssignIntInvalid1() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x:=0.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x 0.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck14AssignIntInvalid2() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x:=\"Hello\";\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x \"Hello\")))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void typecheck15AssignIntInvalid3() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x:=y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int)) (STATLIST (:= x y)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck16AssignIntInvalid4() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: int;"+
+ " y: float;"+
+ "begin\n"+
+ " x:=y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x int) (DECL y float)) (STATLIST (:= x y)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck20AssignFloatValid1() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: float;"+
+ "begin\n"+
+ " x:=0.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 0.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck21AssignFloatValid2() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: float;"+
+ " y: float;"+
+ "begin\n"+
+ " x:=y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y float)) (STATLIST (:= x y)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck22AssignFloatValid3() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: float;"+
+ "begin\n"+
+ " x:=0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck22AssignFloatInvalid2() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: float;"+
+ "begin\n"+
+ " x:=\"Hello\";\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x \"Hello\")))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void typecheck23AssignFloatInvalid3() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: float;"+
+ "begin\n"+
+ " x:=y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float)) (STATLIST (:= x y)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck24AssignFloatInvalid4() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: float;"+
+ " y: string;"+
+ "begin\n"+
+ " x:=y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x float) (DECL y string)) (STATLIST (:= x y)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck30AssignStringValid1() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: string;"+
+ "begin\n"+
+ " x:=\"Hello\";\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x string)) (STATLIST (:= x \"Hello\")))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck31AssignStringValid2() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: string;"+
+ " y: string;"+
+ "begin\n"+
+ " x:=y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x string) (DECL y string)) (STATLIST (:= x y)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck32AssignStringInvalid1() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: string;"+
+ "begin\n"+
+ " x:=0.0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x string)) (STATLIST (:= x 0.0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck33AssignStringInvalid2() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: string;"+
+ "begin\n"+
+ " x:=0;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x string)) (STATLIST (:= x 0)))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void typecheck34AssignStringInvalid3() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: string;"+
+ "begin\n"+
+ " x:=y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x string)) (STATLIST (:= x y)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck35AssignStringInvalid4() throws Exception {
+ String test = "program beginEnd;\n"+
+ " x: string;"+
+ " y: float;"+
+ "begin\n"+
+ " x:=y;\n"+
+ "end.";
+ String expected = "(program beginEnd (DECLLIST (DECL x string) (DECL y float)) (STATLIST (:= x y)))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck40ExprPlus1() throws Exception {
+ String test = "program ExprPlus;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x :=0+1;"+
+ "end.";
+ String expected = "(program ExprPlus (DECLLIST (DECL x int)) (STATLIST (:= x (+ 0 1))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck41ExprPlus2() throws Exception {
+ String test = "program ExprPlus;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x :=0+1.0;"+
+ "end.";
+ String expected = "(program ExprPlus (DECLLIST (DECL x int)) (STATLIST (:= x (+ 0 1.0))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck42ExprPlus3() throws Exception {
+ String test = "program ExprPlus;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x :=\"Hello\"+1;"+
+ "end.";
+ String expected = "(program ExprPlus (DECLLIST (DECL x int)) (STATLIST (:= x (+ \"Hello\" 1))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck43ExprPlus5() throws Exception {
+ String test = "program ExprPlus;\n"+
+ " x: float;"+
+ "begin\n"+
+ " x :=0+1;"+
+ "end.";
+ String expected = "(program ExprPlus (DECLLIST (DECL x float)) (STATLIST (:= x (+ 0 1))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck44ExprPlus6() throws Exception {
+ String test = "program ExprPlus;\n"+
+ " x: float;"+
+ "begin\n"+
+ " x :=0+1.0;"+
+ "end.";
+ String expected = "(program ExprPlus (DECLLIST (DECL x float)) (STATLIST (:= x (+ 0 1.0))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck45ExprPlus7() throws Exception {
+ String test = "program ExprPlus;\n"+
+ " x: float;"+
+ "begin\n"+
+ " x :=0.0+1.0;"+
+ "end.";
+ String expected = "(program ExprPlus (DECLLIST (DECL x float)) (STATLIST (:= x (+ 0.0 1.0))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void typecheck46ExprPlus8() throws Exception {
+ String test = "program ExprPlus;\n"+
+ " x: string;"+
+ "begin\n"+
+ " x :=\"Hello\"+\"World\";"+
+ "end.";
+ String expected = "(program ExprPlus (DECLLIST (DECL x string)) (STATLIST (:= x (+ \"Hello\" \"World\"))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program13ExprMul() throws Exception {
+ String test = "program exprMul;\n"+
+ " x: float;"+
+ "begin\n"+
+ " x :=0*1;"+
+ "end.";
+ String expected = "(program exprMul (DECLLIST (DECL x float)) (STATLIST (:= x (* 0 1))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program14ExprDiv() throws Exception {
+ String test = "program exprDiv;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x :=0/1;"+
+ "end.";
+ String expected = "(program exprDiv (DECLLIST (DECL x int)) (STATLIST (:= x (/ 0 1))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program15ExprUMinus() throws Exception {
+ String test = "program exprUMinus;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x :=0--1;"+
+ "end.";
+ String expected = "(program exprUMinus (DECLLIST (DECL x int)) (STATLIST (:= x (- 0 (UMINUS 1)))))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void program16ExprPlusMinus() throws Exception {
+ String test = "program exprPlus;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x :=0+1+-2-3+4;"+
+ "end.";
+ String expected = "(program exprPlus (DECLLIST (DECL x int)) "
+ + "(STATLIST (:= x (+ (- (+ (+ 0 1) (UMINUS 2)) 3) 4))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program17ExprMulDiv() throws Exception {
+ String test = "program exprMul;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x :=0*1/2*-3*4;"+
+ "end.";
+ String expected = "(program exprMul (DECLLIST (DECL x int)) "
+ + "(STATLIST (:= x (* (* (/ (* 0 1) 2) (UMINUS 3)) 4))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program18ExprAll() throws Exception {
+ String test = "program exprAll;\n"+
+ " x: int;"+
+ "begin\n"+
+ " x :=0*1+2/-3*(4-5+6)*7;"+
+ "end.";
+ String expected = "(program exprAll (DECLLIST (DECL x int)) "
+ + "(STATLIST (:= x (+ (* 0 1) (* (* (/ 2 (UMINUS 3)) (+ (- 4 5) 6)) 7)))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program19ExprVar() throws Exception {
+ String test = "program exprAll;\n"+
+ " x: int;"+
+ " y: int;"+
+ " z: int;"+
+ "begin\n"+
+ " x :=0*x+y;"+
+ "end.";
+ String expected = "(program exprAll (DECLLIST (DECL x int) (DECL y int) (DECL z int)) "
+ + "(STATLIST (:= x (+ (* 0 x) y))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program20Cond() throws Exception {
+ String test = "program cond;\n"+
+ " x: int;"+
+ "begin\n"+
+ " if 2<3 then x:=1;"+
+ "end.";
+ String expected = "(program cond (DECLLIST (DECL x int)) (STATLIST (if (< 2 3) (:= x 1))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program21CondElse() throws Exception {
+ String test = "program condElse;\n"+
+ " x: int;"+
+ "begin\n"+
+ " if 2>3 then x:=1 else x:=2;"+
+ "end.";
+ String expected = "(program condElse (DECLLIST (DECL x int)) (STATLIST (if (> 2 3) (:= x 1) (:= x 2))))";
+ testTypeCheckTree(test, expected);
+ }
+
+ @Test
+ public void program22CondElse2() throws Exception {
+ String test = "program condelse2;\n"+
+ " x: int;"+
+ "begin\n"+
+ " if 2=3 then if 4<5 then x:=1 else x:=2 else x:=3;"+
+ "end.";
+ String expected = "(program condelse2 (DECLLIST (DECL x int)) "
+ + "(STATLIST (if (= 2 3) (if (< 4 5) (:= x 1) (:= x 2)) (:= x 3))))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void program23CondElse3() throws Exception {
+ String test = "program condelse3;\n"+
+ " x: float;"+
+ "begin\n"+
+ " if 2<3 then if 4>5 then x:=1 else if 6=7 then x:=2 else x:=3;"+
+ "end.";
+ String expected = "(program condelse3 (DECLLIST (DECL x float)) "
+ + "(STATLIST (if (< 2 3) (if (> 4 5) (:= x 1) (if (= 6 7) (:= x 2) (:= x 3))))))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void program24CondElse4() throws Exception {
+ String test = "program condelse4;\n"+
+ " x: int;"+
+ "begin\n"+
+ " if 2<3 then if 4>5 then x:=1 else x:=2 else if 6=7 then x:=3 else x:=4;"+
+ "end.";
+ String expected = "(program condelse4 (DECLLIST (DECL x int)) "
+ + "(STATLIST (if (< 2 3) (if (> 4 5) (:= x 1) (:= x 2)) (if (= 6 7) (:= x 3) (:= x 4)))))";
+ testTypeCheckTree(test, expected);
+ }
+
+
+ @Test
+ public void program90Xmin1() throws Exception {
+ String test = "program xmin1;\n"+
+ " read x : int;\n"+
+ " print y : int;\n"+
+ "begin\n"+
+ " y := 25+2*x-6*x;\n"+
+ " if x y (- (+ 25 (* 2