diff --git a/.idea/Java.iml b/.idea/Java.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/Java.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 8ce76e9..bb31f4d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,7 +1,11 @@
-
+
+
+
+
+
@@ -25,8 +29,43 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -37,21 +76,81 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
-
+
+
+
+
+
@@ -67,6 +166,7 @@
1591172713288
+
@@ -78,26 +178,39 @@
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
+
+
+
-
-
+
+
+
-
-
+
+
+
+
diff --git a/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens b/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens
index 2b5d962..6d16bd0 100644
--- a/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens
+++ b/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens
@@ -1,6 +1,63 @@
-T__8=8
-FLOATCONST=4
-ID=5
-INTCONST=6
-WS=7
-'TODO'=8
+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
+BINOP=4
+DECL=5
+DECLIST=6
+ESCAPE=7
+EXPR=8
+FLOATCONST=9
+ID=10
+INTCONST=11
+MODIFIER=12
+PROGRAM=13
+STAT=14
+STATLIST=15
+STRINGCONST=16
+TYPE=17
+UDIVIDE=18
+UMINUS=19
+UMULTIPLY=20
+UPLUS=21
+WS=22
+'('=23
+')'=24
+'*'=20
+'+'=21
+'-'=19
+'.'=25
+'/'=18
+':'=26
+':='=27
+';'=28
+'begin'=29
+'else'=30
+'end'=31
+'float'=32
+'for'=33
+'if'=34
+'int'=35
+'print'=36
+'program'=37
+'read print'=38
+'read'=39
+'string'=40
+'then'=41
+'while'=42
diff --git a/CC-Praxis-Antlr Parser fuer X-Leer/XLexer.java b/CC-Praxis-Antlr Parser fuer X-Leer/XLexer.java
new file mode 100644
index 0000000..de93c5b
--- /dev/null
+++ b/CC-Praxis-Antlr Parser fuer X-Leer/XLexer.java
@@ -0,0 +1,1325 @@
+// $ANTLR 3.5.2 C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g 2020-06-03 13:09:27
+package de.dhbw.compiler.antlrxparser;
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+@SuppressWarnings("all")
+public class XLexer extends Lexer {
+ public static final int EOF=-1;
+ 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 BINOP=4;
+ public static final int DECL=5;
+ public static final int DECLIST=6;
+ public static final int ESCAPE=7;
+ public static final int EXPR=8;
+ public static final int FLOATCONST=9;
+ public static final int ID=10;
+ public static final int INTCONST=11;
+ public static final int MODIFIER=12;
+ public static final int PROGRAM=13;
+ public static final int STAT=14;
+ public static final int STATLIST=15;
+ public static final int STRINGCONST=16;
+ public static final int TYPE=17;
+ public static final int UDIVIDE=18;
+ public static final int UMINUS=19;
+ public static final int UMULTIPLY=20;
+ public static final int UPLUS=21;
+ public static final int WS=22;
+
+ // 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 "C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g"; }
+
+ // $ANTLR start "UDIVIDE"
+ public final void mUDIVIDE() throws RecognitionException {
+ try {
+ int _type = UDIVIDE;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:9:9: ( '/' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:9:11: '/'
+ {
+ match('/');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "UDIVIDE"
+
+ // $ANTLR start "UMINUS"
+ public final void mUMINUS() throws RecognitionException {
+ try {
+ int _type = UMINUS;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:10:8: ( '-' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:10:10: '-'
+ {
+ match('-');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "UMINUS"
+
+ // $ANTLR start "UMULTIPLY"
+ public final void mUMULTIPLY() throws RecognitionException {
+ try {
+ int _type = UMULTIPLY;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:11:11: ( '*' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:11:13: '*'
+ {
+ match('*');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "UMULTIPLY"
+
+ // $ANTLR start "UPLUS"
+ public final void mUPLUS() throws RecognitionException {
+ try {
+ int _type = UPLUS;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:12:7: ( '+' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:12:9: '+'
+ {
+ match('+');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "UPLUS"
+
+ // $ANTLR start "T__23"
+ public final void mT__23() throws RecognitionException {
+ try {
+ int _type = T__23;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:13:7: ( '(' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:13:9: '('
+ {
+ match('(');
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:14:7: ( ')' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:14:9: ')'
+ {
+ match(')');
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:15:7: ( '.' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:15:9: '.'
+ {
+ match('.');
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:16:7: ( ':' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:16:9: ':'
+ {
+ match(':');
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:17:7: ( ':=' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:17:9: ':='
+ {
+ match(":=");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:18:7: ( ';' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:18:9: ';'
+ {
+ match(';');
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:19:7: ( 'begin' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:19:9: 'begin'
+ {
+ match("begin");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:20:7: ( 'else' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:20:9: 'else'
+ {
+ match("else");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:21:7: ( 'end' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:21:9: 'end'
+ {
+ match("end");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:22:7: ( 'float' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:22:9: 'float'
+ {
+ match("float");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:23:7: ( 'for' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:23:9: 'for'
+ {
+ match("for");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:24:7: ( 'if' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:24:9: 'if'
+ {
+ match("if");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:25:7: ( 'int' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:25:9: 'int'
+ {
+ match("int");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:26:7: ( 'print' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:26:9: 'print'
+ {
+ match("print");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:27:7: ( 'program' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:27:9: 'program'
+ {
+ match("program");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:28:7: ( 'read print' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:28:9: 'read print'
+ {
+ match("read print");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:29:7: ( 'read' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:29:9: 'read'
+ {
+ match("read");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:30:7: ( 'string' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:30:9: 'string'
+ {
+ match("string");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:31:7: ( 'then' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:31:9: 'then'
+ {
+ match("then");
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:32:7: ( 'while' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:32:9: 'while'
+ {
+ match("while");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "T__42"
+
+ // $ANTLR start "ID"
+ public final void mID() throws RecognitionException {
+ try {
+ int _type = ID;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:46:3: ( ( 'a' .. 'z' | 'A' .. 'Z' ) ( options {greedy=true; } : 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' )* )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:46:13: ( 'a' .. 'z' | 'A' .. 'Z' ) ( options {greedy=true; } : 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' )*
+ {
+ if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z')||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:47:13: ( options {greedy=true; } : 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' )*
+ loop1:
+ while (true) {
+ int alt1=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':
+ {
+ alt1=1;
+ }
+ break;
+ 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':
+ {
+ alt1=2;
+ }
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ alt1=3;
+ }
+ break;
+ }
+ switch (alt1) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:16: 'a' .. 'z'
+ {
+ matchRange('a','z');
+ }
+ break;
+ case 2 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:27: 'A' .. 'Z'
+ {
+ matchRange('A','Z');
+ }
+ break;
+ case 3 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:38: '0' .. '9'
+ {
+ matchRange('0','9');
+ }
+ break;
+
+ default :
+ break loop1;
+ }
+ }
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ID"
+
+ // $ANTLR start "INTCONST"
+ public final void mINTCONST() throws RecognitionException {
+ try {
+ int _type = INTCONST;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:51:9: ( ( '0' .. '9' )+ )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:51:17: ( '0' .. '9' )+
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:51:17: ( '0' .. '9' )+
+ int cnt2=0;
+ loop2:
+ while (true) {
+ int alt2=2;
+ int LA2_0 = input.LA(1);
+ if ( ((LA2_0 >= '0' && LA2_0 <= '9')) ) {
+ alt2=1;
+ }
+
+ switch (alt2) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ if ( cnt2 >= 1 ) break loop2;
+ EarlyExitException eee = new EarlyExitException(2, input);
+ throw eee;
+ }
+ cnt2++;
+ }
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:52:11: ( INTCONST '.' INTCONST )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:52:17: INTCONST '.' INTCONST
+ {
+ mINTCONST();
+
+ match('.');
+ mINTCONST();
+
+ }
+
+ 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;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:54:12: ( '\"' ( ESCAPE |~ ( '\\\\' | '\"' ) )* '\"' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:54:17: '\"' ( ESCAPE |~ ( '\\\\' | '\"' ) )* '\"'
+ {
+ match('\"');
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:54:21: ( ESCAPE |~ ( '\\\\' | '\"' ) )*
+ loop3:
+ while (true) {
+ int alt3=3;
+ int LA3_0 = input.LA(1);
+ if ( (LA3_0=='\\') ) {
+ alt3=1;
+ }
+ else if ( ((LA3_0 >= '\u0000' && LA3_0 <= '!')||(LA3_0 >= '#' && LA3_0 <= '[')||(LA3_0 >= ']' && LA3_0 <= '\uFFFF')) ) {
+ alt3=2;
+ }
+
+ switch (alt3) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:54:22: ESCAPE
+ {
+ mESCAPE();
+
+ }
+ break;
+ case 2 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:54:31: ~ ( '\\\\' | '\"' )
+ {
+ if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '!')||(input.LA(1) >= '#' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ break loop3;
+ }
+ }
+
+ match('\"');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "STRINGCONST"
+
+ // $ANTLR start "ESCAPE"
+ public final void mESCAPE() throws RecognitionException {
+ try {
+ int _type = ESCAPE;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:55:7: ( '\\\\' ( '\\\"' | '\\'' | '\\\\' ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:55:17: '\\\\' ( '\\\"' | '\\'' | '\\\\' )
+ {
+ match('\\');
+ if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ESCAPE"
+
+ // $ANTLR start "BINOP"
+ public final void mBINOP() throws RecognitionException {
+ try {
+ int _type = BINOP;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:57:6: ( '+' | '-' | '*' | '/' | '<' | '>' | '=' )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:
+ {
+ if ( (input.LA(1) >= '*' && input.LA(1) <= '+')||input.LA(1)=='-'||input.LA(1)=='/'||(input.LA(1) >= '<' && input.LA(1) <= '>') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "BINOP"
+
+ // $ANTLR start "WS"
+ public final void mWS() throws RecognitionException {
+ try {
+ int _type = WS;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:59:3: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:59:13: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:59:13: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+
+ int cnt4=0;
+ loop4:
+ while (true) {
+ int alt4=2;
+ int LA4_0 = input.LA(1);
+ if ( ((LA4_0 >= '\t' && LA4_0 <= '\n')||(LA4_0 >= '\f' && LA4_0 <= '\r')||LA4_0==' ') ) {
+ alt4=1;
+ }
+
+ switch (alt4) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:
+ {
+ if ( (input.LA(1) >= '\t' && input.LA(1) <= '\n')||(input.LA(1) >= '\f' && input.LA(1) <= '\r')||input.LA(1)==' ' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ if ( cnt4 >= 1 ) break loop4;
+ EarlyExitException eee = new EarlyExitException(4, input);
+ throw eee;
+ }
+ cnt4++;
+ }
+
+ skip();
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "WS"
+
+ @Override
+ public void mTokens() throws RecognitionException {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:8: ( UDIVIDE | UMINUS | UMULTIPLY | UPLUS | 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 | ID | INTCONST | FLOATCONST | STRINGCONST | ESCAPE | BINOP | WS )
+ int alt5=31;
+ alt5 = dfa5.predict(input);
+ switch (alt5) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:10: UDIVIDE
+ {
+ mUDIVIDE();
+
+ }
+ break;
+ case 2 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:18: UMINUS
+ {
+ mUMINUS();
+
+ }
+ break;
+ case 3 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:25: UMULTIPLY
+ {
+ mUMULTIPLY();
+
+ }
+ break;
+ case 4 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:35: UPLUS
+ {
+ mUPLUS();
+
+ }
+ break;
+ case 5 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:41: T__23
+ {
+ mT__23();
+
+ }
+ break;
+ case 6 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:47: T__24
+ {
+ mT__24();
+
+ }
+ break;
+ case 7 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:53: T__25
+ {
+ mT__25();
+
+ }
+ break;
+ case 8 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:59: T__26
+ {
+ mT__26();
+
+ }
+ break;
+ case 9 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:65: T__27
+ {
+ mT__27();
+
+ }
+ break;
+ case 10 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:71: T__28
+ {
+ mT__28();
+
+ }
+ break;
+ case 11 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:77: T__29
+ {
+ mT__29();
+
+ }
+ break;
+ case 12 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:83: T__30
+ {
+ mT__30();
+
+ }
+ break;
+ case 13 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:89: T__31
+ {
+ mT__31();
+
+ }
+ break;
+ case 14 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:95: T__32
+ {
+ mT__32();
+
+ }
+ break;
+ case 15 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:101: T__33
+ {
+ mT__33();
+
+ }
+ break;
+ case 16 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:107: T__34
+ {
+ mT__34();
+
+ }
+ break;
+ case 17 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:113: T__35
+ {
+ mT__35();
+
+ }
+ break;
+ case 18 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:119: T__36
+ {
+ mT__36();
+
+ }
+ break;
+ case 19 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:125: T__37
+ {
+ mT__37();
+
+ }
+ break;
+ case 20 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:131: T__38
+ {
+ mT__38();
+
+ }
+ break;
+ case 21 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:137: T__39
+ {
+ mT__39();
+
+ }
+ break;
+ case 22 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:143: T__40
+ {
+ mT__40();
+
+ }
+ break;
+ case 23 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:149: T__41
+ {
+ mT__41();
+
+ }
+ break;
+ case 24 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:155: T__42
+ {
+ mT__42();
+
+ }
+ break;
+ case 25 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:161: ID
+ {
+ mID();
+
+ }
+ break;
+ case 26 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:164: INTCONST
+ {
+ mINTCONST();
+
+ }
+ break;
+ case 27 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:173: FLOATCONST
+ {
+ mFLOATCONST();
+
+ }
+ break;
+ case 28 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:184: STRINGCONST
+ {
+ mSTRINGCONST();
+
+ }
+ break;
+ case 29 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:196: ESCAPE
+ {
+ mESCAPE();
+
+ }
+ break;
+ case 30 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:203: BINOP
+ {
+ mBINOP();
+
+ }
+ break;
+ case 31 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:209: WS
+ {
+ mWS();
+
+ }
+ break;
+
+ }
+ }
+
+
+ protected DFA5 dfa5 = new DFA5(this);
+ static final String DFA5_eotS =
+ "\10\uffff\1\36\1\uffff\11\23\1\uffff\1\53\12\uffff\5\23\1\62\6\23\2\uffff"+
+ "\2\23\1\74\1\23\1\76\1\uffff\1\77\7\23\1\107\1\uffff\1\23\2\uffff\2\23"+
+ "\1\114\1\23\1\116\1\23\1\120\1\uffff\1\121\1\122\1\23\2\uffff\1\23\1\uffff"+
+ "\1\125\3\uffff\1\23\1\127\1\uffff\1\130\2\uffff";
+ static final String DFA5_eofS =
+ "\131\uffff";
+ static final String DFA5_minS =
+ "\1\11\7\uffff\1\75\1\uffff\1\145\2\154\1\146\1\162\1\145\1\164\2\150\1"+
+ "\uffff\1\56\12\uffff\1\147\1\163\1\144\1\157\1\162\1\60\1\164\1\151\1"+
+ "\141\1\162\1\145\1\151\2\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\40\1\156\1\60\1\145\1\60\1\uffff\2\60\1\141\2\uffff\1\147"+
+ "\1\uffff\1\60\3\uffff\1\155\1\60\1\uffff\1\60\2\uffff";
+ static final String DFA5_maxS =
+ "\1\172\7\uffff\1\75\1\uffff\1\145\1\156\1\157\1\156\1\162\1\145\1\164"+
+ "\2\150\1\uffff\1\71\12\uffff\1\147\1\163\1\144\1\157\1\162\1\172\1\164"+
+ "\1\157\1\141\1\162\1\145\1\151\2\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\2\uffff\1\147\1\uffff\1\172\3\uffff\1\155\1\172\1\uffff\1\172\2\uffff";
+ static final String DFA5_acceptS =
+ "\1\uffff\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\uffff\1\12\11\uffff\1\31\1\uffff"+
+ "\1\34\1\35\1\36\1\37\1\1\1\2\1\3\1\4\1\11\1\10\14\uffff\1\32\1\33\5\uffff"+
+ "\1\20\11\uffff\1\15\1\uffff\1\17\1\21\7\uffff\1\14\3\uffff\1\24\1\25\1"+
+ "\uffff\1\27\1\uffff\1\13\1\16\1\22\2\uffff\1\30\1\uffff\1\26\1\23";
+ static final String DFA5_specialS =
+ "\131\uffff}>";
+ static final String[] DFA5_transitionS = {
+ "\2\30\1\uffff\2\30\22\uffff\1\30\1\uffff\1\25\5\uffff\1\5\1\6\1\3\1\4"+
+ "\1\uffff\1\2\1\7\1\1\12\24\1\10\1\11\3\27\2\uffff\32\23\1\uffff\1\26"+
+ "\4\uffff\1\23\1\12\2\23\1\13\1\14\2\23\1\15\6\23\1\16\1\23\1\17\1\20"+
+ "\1\21\2\23\1\22\3\23",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "\1\35",
+ "",
+ "\1\37",
+ "\1\40\1\uffff\1\41",
+ "\1\42\2\uffff\1\43",
+ "\1\44\7\uffff\1\45",
+ "\1\46",
+ "\1\47",
+ "\1\50",
+ "\1\51",
+ "\1\52",
+ "",
+ "\1\54\1\uffff\12\24",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "\1\55",
+ "\1\56",
+ "\1\57",
+ "\1\60",
+ "\1\61",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "\1\63",
+ "\1\64\5\uffff\1\65",
+ "\1\66",
+ "\1\67",
+ "\1\70",
+ "\1\71",
+ "",
+ "",
+ "\1\72",
+ "\1\73",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "\1\75",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "\1\100",
+ "\1\101",
+ "\1\102",
+ "\1\103",
+ "\1\104",
+ "\1\105",
+ "\1\106",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "",
+ "\1\110",
+ "",
+ "",
+ "\1\111",
+ "\1\112",
+ "\1\113\17\uffff\12\23\7\uffff\32\23\6\uffff\32\23",
+ "\1\115",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "\1\117",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "\1\123",
+ "",
+ "",
+ "\1\124",
+ "",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "",
+ "",
+ "",
+ "\1\126",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "",
+ "\12\23\7\uffff\32\23\6\uffff\32\23",
+ "",
+ ""
+ };
+
+ static final short[] DFA5_eot = DFA.unpackEncodedString(DFA5_eotS);
+ static final short[] DFA5_eof = DFA.unpackEncodedString(DFA5_eofS);
+ static final char[] DFA5_min = DFA.unpackEncodedStringToUnsignedChars(DFA5_minS);
+ static final char[] DFA5_max = DFA.unpackEncodedStringToUnsignedChars(DFA5_maxS);
+ static final short[] DFA5_accept = DFA.unpackEncodedString(DFA5_acceptS);
+ static final short[] DFA5_special = DFA.unpackEncodedString(DFA5_specialS);
+ static final short[][] DFA5_transition;
+
+ static {
+ int numStates = DFA5_transitionS.length;
+ DFA5_transition = new short[numStates][];
+ for (int i=0; i", "", "", "", "BINOP", "DECL", "DECLIST", "ESCAPE",
+ "EXPR", "FLOATCONST", "ID", "INTCONST", "MODIFIER", "PROGRAM", "STAT",
+ "STATLIST", "STRINGCONST", "TYPE", "UDIVIDE", "UMINUS", "UMULTIPLY", "UPLUS",
+ "WS", "'('", "')'", "'.'", "':'", "':='", "';'", "'begin'", "'else'",
+ "'end'", "'float'", "'for'", "'if'", "'int'", "'print'", "'program'",
+ "'read print'", "'read'", "'string'", "'then'", "'while'"
+ };
+ public static final int EOF=-1;
+ 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 BINOP=4;
+ public static final int DECL=5;
+ public static final int DECLIST=6;
+ public static final int ESCAPE=7;
+ public static final int EXPR=8;
+ public static final int FLOATCONST=9;
+ public static final int ID=10;
+ public static final int INTCONST=11;
+ public static final int MODIFIER=12;
+ public static final int PROGRAM=13;
+ public static final int STAT=14;
+ public static final int STATLIST=15;
+ public static final int STRINGCONST=16;
+ public static final int TYPE=17;
+ public static final int UDIVIDE=18;
+ public static final int UMINUS=19;
+ public static final int UMULTIPLY=20;
+ public static final int UPLUS=21;
+ public static final int WS=22;
+
+ // 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 "C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g"; }
+
+
+ public static class program_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "program"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:63: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);
+
+ CommonTree root_0 = null;
+
+ Token string_literal1=null;
+ Token ID2=null;
+ Token char_literal3=null;
+ Token char_literal6=null;
+ Token EOF7=null;
+ ParserRuleReturnScope decllist4 =null;
+ ParserRuleReturnScope statlist5 =null;
+
+ CommonTree string_literal1_tree=null;
+ CommonTree ID2_tree=null;
+ CommonTree char_literal3_tree=null;
+ CommonTree char_literal6_tree=null;
+ CommonTree EOF7_tree=null;
+ RewriteRuleTokenStream stream_25=new RewriteRuleTokenStream(adaptor,"token 25");
+ RewriteRuleTokenStream stream_37=new RewriteRuleTokenStream(adaptor,"token 37");
+ RewriteRuleTokenStream stream_28=new RewriteRuleTokenStream(adaptor,"token 28");
+ RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
+ 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 {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:63:8: ( 'program' ID ';' decllist statlist '.' EOF -> ^( PROGRAM ID decllist statlist ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:63:13: 'program' ID ';' decllist statlist '.' EOF
+ {
+ string_literal1=(Token)match(input,37,FOLLOW_37_in_program443); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_37.add(string_literal1);
+
+ ID2=(Token)match(input,ID,FOLLOW_ID_in_program445); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ID.add(ID2);
+
+ char_literal3=(Token)match(input,28,FOLLOW_28_in_program447); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_28.add(char_literal3);
+
+ pushFollow(FOLLOW_decllist_in_program449);
+ decllist4=decllist();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_decllist.add(decllist4.getTree());
+ pushFollow(FOLLOW_statlist_in_program451);
+ statlist5=statlist();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_statlist.add(statlist5.getTree());
+ char_literal6=(Token)match(input,25,FOLLOW_25_in_program453); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_25.add(char_literal6);
+
+ EOF7=(Token)match(input,EOF,FOLLOW_EOF_in_program455); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_EOF.add(EOF7);
+
+ // AST REWRITE
+ // elements: ID, statlist, decllist
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 63:56: -> ^( PROGRAM ID decllist statlist )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:63:59: ^( PROGRAM ID decllist statlist )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(PROGRAM, "PROGRAM"), 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);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "program"
+
+
+ public static class decllist_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "decllist"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:66:1: decllist : decl decllist -> ^( DECLIST decl decllist ) ;
+ public final XParser.decllist_return decllist() throws RecognitionException {
+ XParser.decllist_return retval = new XParser.decllist_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope decl8 =null;
+ ParserRuleReturnScope decllist9 =null;
+
+ RewriteRuleSubtreeStream stream_decl=new RewriteRuleSubtreeStream(adaptor,"rule decl");
+ RewriteRuleSubtreeStream stream_decllist=new RewriteRuleSubtreeStream(adaptor,"rule decllist");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:66:9: ( decl decllist -> ^( DECLIST decl decllist ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:66:17: decl decllist
+ {
+ pushFollow(FOLLOW_decl_in_decllist481);
+ decl8=decl();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_decl.add(decl8.getTree());
+ pushFollow(FOLLOW_decllist_in_decllist483);
+ decllist9=decllist();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_decllist.add(decllist9.getTree());
+ // AST REWRITE
+ // elements: decl, decllist
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 66:31: -> ^( DECLIST decl decllist )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:66:34: ^( DECLIST decl decllist )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECLIST, "DECLIST"), root_1);
+ adaptor.addChild(root_1, stream_decl.nextTree());
+ adaptor.addChild(root_1, stream_decllist.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "decllist"
+
+
+ public static class decl_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "decl"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:1: decl : modifier ID ':' type ';' -> ^( DECL modifier ID type ) ;
+ public final XParser.decl_return decl() throws RecognitionException {
+ XParser.decl_return retval = new XParser.decl_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token ID11=null;
+ Token char_literal12=null;
+ Token char_literal14=null;
+ ParserRuleReturnScope modifier10 =null;
+ ParserRuleReturnScope type13 =null;
+
+ CommonTree ID11_tree=null;
+ CommonTree char_literal12_tree=null;
+ CommonTree char_literal14_tree=null;
+ RewriteRuleTokenStream stream_26=new RewriteRuleTokenStream(adaptor,"token 26");
+ RewriteRuleTokenStream stream_28=new RewriteRuleTokenStream(adaptor,"token 28");
+ RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
+ RewriteRuleSubtreeStream stream_modifier=new RewriteRuleSubtreeStream(adaptor,"rule modifier");
+ RewriteRuleSubtreeStream stream_type=new RewriteRuleSubtreeStream(adaptor,"rule type");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:5: ( modifier ID ':' type ';' -> ^( DECL modifier ID type ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:17: modifier ID ':' type ';'
+ {
+ pushFollow(FOLLOW_modifier_in_decl509);
+ modifier10=modifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_modifier.add(modifier10.getTree());
+ ID11=(Token)match(input,ID,FOLLOW_ID_in_decl511); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ID.add(ID11);
+
+ char_literal12=(Token)match(input,26,FOLLOW_26_in_decl513); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_26.add(char_literal12);
+
+ pushFollow(FOLLOW_type_in_decl515);
+ type13=type();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_type.add(type13.getTree());
+ char_literal14=(Token)match(input,28,FOLLOW_28_in_decl517); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_28.add(char_literal14);
+
+ // AST REWRITE
+ // elements: type, modifier, ID
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 67:42: -> ^( DECL modifier ID type )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:45: ^( DECL modifier ID type )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECL, "DECL"), root_1);
+ adaptor.addChild(root_1, stream_modifier.nextTree());
+ adaptor.addChild(root_1, stream_ID.nextNode());
+ adaptor.addChild(root_1, stream_type.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "decl"
+
+
+ public static class modifier_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "modifier"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:1: modifier : (mod= 'read' |mod= 'print' |mod= 'read print' -> ^( MODIFIER[mod] ) );
+ public final XParser.modifier_return modifier() throws RecognitionException {
+ XParser.modifier_return retval = new XParser.modifier_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token mod=null;
+
+ CommonTree mod_tree=null;
+ RewriteRuleTokenStream stream_38=new RewriteRuleTokenStream(adaptor,"token 38");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:9: (mod= 'read' |mod= 'print' |mod= 'read print' -> ^( MODIFIER[mod] ) )
+ int alt1=3;
+ switch ( input.LA(1) ) {
+ case 39:
+ {
+ alt1=1;
+ }
+ break;
+ case 36:
+ {
+ alt1=2;
+ }
+ break;
+ case 38:
+ {
+ alt1=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 1, 0, input);
+ throw nvae;
+ }
+ switch (alt1) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:17: mod= 'read'
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ mod=(Token)match(input,39,FOLLOW_39_in_modifier543); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ mod_tree = (CommonTree)adaptor.create(mod);
+ adaptor.addChild(root_0, mod_tree);
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:30: mod= 'print'
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ mod=(Token)match(input,36,FOLLOW_36_in_modifier549); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ mod_tree = (CommonTree)adaptor.create(mod);
+ adaptor.addChild(root_0, mod_tree);
+ }
+
+ }
+ break;
+ case 3 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:44: mod= 'read print'
+ {
+ mod=(Token)match(input,38,FOLLOW_38_in_modifier555); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_38.add(mod);
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 68:61: -> ^( MODIFIER[mod] )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:64: ^( MODIFIER[mod] )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(MODIFIER, mod), root_1);
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "modifier"
+
+
+ public static class type_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "type"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:69:1: type : (t= 'int' |t= 'float' |t= 'string' -> ^( TYPE[t] ) );
+ public final XParser.type_return type() throws RecognitionException {
+ XParser.type_return retval = new XParser.type_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token t=null;
+
+ CommonTree t_tree=null;
+ RewriteRuleTokenStream stream_40=new RewriteRuleTokenStream(adaptor,"token 40");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:69:5: (t= 'int' |t= 'float' |t= 'string' -> ^( TYPE[t] ) )
+ int alt2=3;
+ switch ( input.LA(1) ) {
+ case 35:
+ {
+ alt2=1;
+ }
+ break;
+ case 32:
+ {
+ alt2=2;
+ }
+ break;
+ case 40:
+ {
+ alt2=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 2, 0, input);
+ throw nvae;
+ }
+ switch (alt2) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:69:17: t= 'int'
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ t=(Token)match(input,35,FOLLOW_35_in_type580); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ t_tree = (CommonTree)adaptor.create(t);
+ adaptor.addChild(root_0, t_tree);
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:69:27: t= 'float'
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ t=(Token)match(input,32,FOLLOW_32_in_type586); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ t_tree = (CommonTree)adaptor.create(t);
+ adaptor.addChild(root_0, t_tree);
+ }
+
+ }
+ break;
+ case 3 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:69:39: t= 'string'
+ {
+ t=(Token)match(input,40,FOLLOW_40_in_type592); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_40.add(t);
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 69:50: -> ^( TYPE[t] )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:69:53: ^( TYPE[t] )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE, t), root_1);
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "type"
+
+
+ public static class statlist_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "statlist"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72: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);
+
+ CommonTree root_0 = null;
+
+ Token string_literal15=null;
+ Token char_literal17=null;
+ Token string_literal18=null;
+ ParserRuleReturnScope stat16 =null;
+
+ CommonTree string_literal15_tree=null;
+ CommonTree char_literal17_tree=null;
+ CommonTree string_literal18_tree=null;
+ RewriteRuleTokenStream stream_28=new RewriteRuleTokenStream(adaptor,"token 28");
+ RewriteRuleTokenStream stream_29=new RewriteRuleTokenStream(adaptor,"token 29");
+ RewriteRuleTokenStream stream_31=new RewriteRuleTokenStream(adaptor,"token 31");
+ RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:9: ( 'begin' ( stat ';' )* 'end' -> ^( STATLIST ( stat )* ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:17: 'begin' ( stat ';' )* 'end'
+ {
+ string_literal15=(Token)match(input,29,FOLLOW_29_in_statlist613); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_29.add(string_literal15);
+
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:25: ( stat ';' )*
+ loop3:
+ while (true) {
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+ if ( (LA3_0==ID||LA3_0==29||(LA3_0 >= 33 && LA3_0 <= 34)||LA3_0==42) ) {
+ alt3=1;
+ }
+
+ switch (alt3) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:26: stat ';'
+ {
+ pushFollow(FOLLOW_stat_in_statlist616);
+ stat16=stat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_stat.add(stat16.getTree());
+ char_literal17=(Token)match(input,28,FOLLOW_28_in_statlist618); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_28.add(char_literal17);
+
+ }
+ break;
+
+ default :
+ break loop3;
+ }
+ }
+
+ string_literal18=(Token)match(input,31,FOLLOW_31_in_statlist622); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_31.add(string_literal18);
+
+ // AST REWRITE
+ // elements: stat
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 72:43: -> ^( STATLIST ( stat )* )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:46: ^( STATLIST ( stat )* )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STATLIST, "STATLIST"), root_1);
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:57: ( 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);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "statlist"
+
+
+ public static class stat_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "stat"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:1: stat : (t= assignstat |t= condstat |t= whilestat |t= forstat -> ^( STAT[t] ) | statlist -> ^( STATLIST statlist ) );
+ public final XParser.stat_return stat() throws RecognitionException {
+ XParser.stat_return retval = new XParser.stat_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope t =null;
+ ParserRuleReturnScope statlist19 =null;
+
+ RewriteRuleSubtreeStream stream_statlist=new RewriteRuleSubtreeStream(adaptor,"rule statlist");
+ RewriteRuleSubtreeStream stream_forstat=new RewriteRuleSubtreeStream(adaptor,"rule forstat");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:5: (t= assignstat |t= condstat |t= whilestat |t= forstat -> ^( STAT[t] ) | statlist -> ^( STATLIST statlist ) )
+ int alt4=5;
+ switch ( input.LA(1) ) {
+ case ID:
+ {
+ alt4=1;
+ }
+ break;
+ case 34:
+ {
+ alt4=2;
+ }
+ break;
+ case 42:
+ {
+ alt4=3;
+ }
+ break;
+ case 33:
+ {
+ alt4=4;
+ }
+ break;
+ case 29:
+ {
+ alt4=5;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 4, 0, input);
+ throw nvae;
+ }
+ switch (alt4) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:17: t= assignstat
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_assignstat_in_stat649);
+ t=assignstat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, t.getTree());
+
+ }
+ break;
+ case 2 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:32: t= condstat
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_condstat_in_stat655);
+ t=condstat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, t.getTree());
+
+ }
+ break;
+ case 3 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:45: t= whilestat
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_whilestat_in_stat661);
+ t=whilestat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, t.getTree());
+
+ }
+ break;
+ case 4 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:59: t= forstat
+ {
+ pushFollow(FOLLOW_forstat_in_stat667);
+ t=forstat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_forstat.add(t.getTree());
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 73:69: -> ^( STAT[t] )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:72: ^( STAT[t] )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STAT, t), root_1);
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 5 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:74:19: statlist
+ {
+ pushFollow(FOLLOW_statlist_in_stat694);
+ statlist19=statlist();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_statlist.add(statlist19.getTree());
+ // AST REWRITE
+ // elements: statlist
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 75:17: -> ^( STATLIST statlist )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:75:20: ^( STATLIST statlist )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STATLIST, "STATLIST"), root_1);
+ adaptor.addChild(root_1, stream_statlist.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "stat"
+
+
+ public static class assignstat_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "assignstat"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:76:1: assignstat : ID ':=' expr -> ^( ':=' ID expr ) ;
+ public final XParser.assignstat_return assignstat() throws RecognitionException {
+ XParser.assignstat_return retval = new XParser.assignstat_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token ID20=null;
+ Token string_literal21=null;
+ ParserRuleReturnScope expr22 =null;
+
+ CommonTree ID20_tree=null;
+ CommonTree string_literal21_tree=null;
+ RewriteRuleTokenStream stream_27=new RewriteRuleTokenStream(adaptor,"token 27");
+ RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
+ RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:76:11: ( ID ':=' expr -> ^( ':=' ID expr ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:76:17: ID ':=' expr
+ {
+ ID20=(Token)match(input,ID,FOLLOW_ID_in_assignstat728); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ID.add(ID20);
+
+ string_literal21=(Token)match(input,27,FOLLOW_27_in_assignstat730); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_27.add(string_literal21);
+
+ pushFollow(FOLLOW_expr_in_assignstat732);
+ expr22=expr();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr.add(expr22.getTree());
+ // AST REWRITE
+ // elements: ID, expr, 27
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 76:30: -> ^( ':=' ID expr )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:76:33: ^( ':=' ID expr )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_27.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_ID.nextNode());
+ adaptor.addChild(root_1, stream_expr.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "assignstat"
+
+
+ public static class condstat_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "condstat"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:1: condstat : 'if' cond 'then' stat ( condElseStat )? -> ^( 'if' cond stat ( condElseStat )? ) ;
+ public final XParser.condstat_return condstat() throws RecognitionException {
+ XParser.condstat_return retval = new XParser.condstat_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token string_literal23=null;
+ Token string_literal25=null;
+ ParserRuleReturnScope cond24 =null;
+ ParserRuleReturnScope stat26 =null;
+ ParserRuleReturnScope condElseStat27 =null;
+
+ CommonTree string_literal23_tree=null;
+ CommonTree string_literal25_tree=null;
+ RewriteRuleTokenStream stream_34=new RewriteRuleTokenStream(adaptor,"token 34");
+ RewriteRuleTokenStream stream_41=new RewriteRuleTokenStream(adaptor,"token 41");
+ RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat");
+ RewriteRuleSubtreeStream stream_condElseStat=new RewriteRuleSubtreeStream(adaptor,"rule condElseStat");
+ RewriteRuleSubtreeStream stream_cond=new RewriteRuleSubtreeStream(adaptor,"rule cond");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:9: ( 'if' cond 'then' stat ( condElseStat )? -> ^( 'if' cond stat ( condElseStat )? ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:17: 'if' cond 'then' stat ( condElseStat )?
+ {
+ string_literal23=(Token)match(input,34,FOLLOW_34_in_condstat754); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_34.add(string_literal23);
+
+ pushFollow(FOLLOW_cond_in_condstat756);
+ cond24=cond();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_cond.add(cond24.getTree());
+ string_literal25=(Token)match(input,41,FOLLOW_41_in_condstat758); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_41.add(string_literal25);
+
+ pushFollow(FOLLOW_stat_in_condstat760);
+ stat26=stat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_stat.add(stat26.getTree());
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:39: ( condElseStat )?
+ int alt5=2;
+ int LA5_0 = input.LA(1);
+ if ( (LA5_0==30) ) {
+ int LA5_1 = input.LA(2);
+ if ( (synpred10_X()) ) {
+ alt5=1;
+ }
+ }
+ switch (alt5) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:39: condElseStat
+ {
+ pushFollow(FOLLOW_condElseStat_in_condstat762);
+ condElseStat27=condElseStat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_condElseStat.add(condElseStat27.getTree());
+ }
+ break;
+
+ }
+
+ // AST REWRITE
+ // elements: cond, 34, stat, condElseStat
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 77:53: -> ^( 'if' cond stat ( condElseStat )? )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:56: ^( 'if' cond stat ( condElseStat )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_34.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_cond.nextTree());
+ adaptor.addChild(root_1, stream_stat.nextTree());
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:73: ( condElseStat )?
+ if ( stream_condElseStat.hasNext() ) {
+ adaptor.addChild(root_1, stream_condElseStat.nextTree());
+ }
+ stream_condElseStat.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "condstat"
+
+
+ public static class condElseStat_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "condElseStat"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:78:1: condElseStat : 'else' stat -> ^( 'else' stat ) ;
+ public final XParser.condElseStat_return condElseStat() throws RecognitionException {
+ XParser.condElseStat_return retval = new XParser.condElseStat_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token string_literal28=null;
+ ParserRuleReturnScope stat29 =null;
+
+ CommonTree string_literal28_tree=null;
+ RewriteRuleTokenStream stream_30=new RewriteRuleTokenStream(adaptor,"token 30");
+ RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:78:13: ( 'else' stat -> ^( 'else' stat ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:78:17: 'else' stat
+ {
+ string_literal28=(Token)match(input,30,FOLLOW_30_in_condElseStat785); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_30.add(string_literal28);
+
+ pushFollow(FOLLOW_stat_in_condElseStat787);
+ stat29=stat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_stat.add(stat29.getTree());
+ // AST REWRITE
+ // elements: 30, stat
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 78:29: -> ^( 'else' stat )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:78:32: ^( 'else' stat )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_30.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_stat.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "condElseStat"
+
+
+ public static class whilestat_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "whilestat"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:79: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);
+
+ CommonTree root_0 = null;
+
+ Token string_literal30=null;
+ Token char_literal31=null;
+ Token char_literal33=null;
+ ParserRuleReturnScope cond32 =null;
+ ParserRuleReturnScope stat34 =null;
+
+ CommonTree string_literal30_tree=null;
+ CommonTree char_literal31_tree=null;
+ CommonTree char_literal33_tree=null;
+ RewriteRuleTokenStream stream_23=new RewriteRuleTokenStream(adaptor,"token 23");
+ RewriteRuleTokenStream stream_24=new RewriteRuleTokenStream(adaptor,"token 24");
+ RewriteRuleTokenStream stream_42=new RewriteRuleTokenStream(adaptor,"token 42");
+ RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat");
+ RewriteRuleSubtreeStream stream_cond=new RewriteRuleSubtreeStream(adaptor,"rule cond");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:79:10: ( 'while' '(' cond ')' stat -> ^( 'while' cond stat ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:79:17: 'while' '(' cond ')' stat
+ {
+ string_literal30=(Token)match(input,42,FOLLOW_42_in_whilestat806); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_42.add(string_literal30);
+
+ char_literal31=(Token)match(input,23,FOLLOW_23_in_whilestat808); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_23.add(char_literal31);
+
+ pushFollow(FOLLOW_cond_in_whilestat810);
+ cond32=cond();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_cond.add(cond32.getTree());
+ char_literal33=(Token)match(input,24,FOLLOW_24_in_whilestat812); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_24.add(char_literal33);
+
+ pushFollow(FOLLOW_stat_in_whilestat814);
+ stat34=stat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_stat.add(stat34.getTree());
+ // AST REWRITE
+ // elements: cond, stat, 42
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 79:43: -> ^( 'while' cond stat )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:79:46: ^( 'while' cond stat )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_42.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);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)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 {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "forstat"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:80:1: forstat : 'for' '(' assignstat ';' cond ';' assignstat ')' stat -> ^( '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);
+
+ CommonTree root_0 = null;
+
+ Token string_literal35=null;
+ Token char_literal36=null;
+ Token char_literal38=null;
+ Token char_literal40=null;
+ Token char_literal42=null;
+ ParserRuleReturnScope assignstat37 =null;
+ ParserRuleReturnScope cond39 =null;
+ ParserRuleReturnScope assignstat41 =null;
+ ParserRuleReturnScope stat43 =null;
+
+ CommonTree string_literal35_tree=null;
+ CommonTree char_literal36_tree=null;
+ CommonTree char_literal38_tree=null;
+ CommonTree char_literal40_tree=null;
+ CommonTree char_literal42_tree=null;
+ RewriteRuleTokenStream stream_33=new RewriteRuleTokenStream(adaptor,"token 33");
+ RewriteRuleTokenStream stream_23=new RewriteRuleTokenStream(adaptor,"token 23");
+ RewriteRuleTokenStream stream_24=new RewriteRuleTokenStream(adaptor,"token 24");
+ RewriteRuleTokenStream stream_28=new RewriteRuleTokenStream(adaptor,"token 28");
+ RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat");
+ RewriteRuleSubtreeStream stream_cond=new RewriteRuleSubtreeStream(adaptor,"rule cond");
+ RewriteRuleSubtreeStream stream_assignstat=new RewriteRuleSubtreeStream(adaptor,"rule assignstat");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:80:8: ( 'for' '(' assignstat ';' cond ';' assignstat ')' stat -> ^( 'for' assignstat cond assignstat stat ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:80:17: 'for' '(' assignstat ';' cond ';' assignstat ')' stat
+ {
+ string_literal35=(Token)match(input,33,FOLLOW_33_in_forstat837); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_33.add(string_literal35);
+
+ char_literal36=(Token)match(input,23,FOLLOW_23_in_forstat839); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_23.add(char_literal36);
+
+ pushFollow(FOLLOW_assignstat_in_forstat841);
+ assignstat37=assignstat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_assignstat.add(assignstat37.getTree());
+ char_literal38=(Token)match(input,28,FOLLOW_28_in_forstat843); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_28.add(char_literal38);
+
+ pushFollow(FOLLOW_cond_in_forstat845);
+ cond39=cond();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_cond.add(cond39.getTree());
+ char_literal40=(Token)match(input,28,FOLLOW_28_in_forstat847); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_28.add(char_literal40);
+
+ pushFollow(FOLLOW_assignstat_in_forstat849);
+ assignstat41=assignstat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_assignstat.add(assignstat41.getTree());
+ char_literal42=(Token)match(input,24,FOLLOW_24_in_forstat851); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_24.add(char_literal42);
+
+ pushFollow(FOLLOW_stat_in_forstat853);
+ stat43=stat();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_stat.add(stat43.getTree());
+ // AST REWRITE
+ // elements: cond, stat, assignstat, 33, assignstat
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 81:17: -> ^( 'for' assignstat cond assignstat stat )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:81:20: ^( 'for' assignstat cond assignstat stat )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_33.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_assignstat.nextTree());
+ adaptor.addChild(root_1, stream_cond.nextTree());
+ adaptor.addChild(root_1, stream_assignstat.nextTree());
+ adaptor.addChild(root_1, stream_stat.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "forstat"
+
+
+ public static class expr_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "expr"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:83:1: expr : ( expr2 UPLUS expr -> ^( UPLUS expr2 expr ) | expr2 UMINUS expr -> ^( UMINUS expr2 expr ) | expr2 -> ^( expr2 ) );
+ public final XParser.expr_return expr() throws RecognitionException {
+ XParser.expr_return retval = new XParser.expr_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token UPLUS45=null;
+ Token UMINUS48=null;
+ ParserRuleReturnScope expr244 =null;
+ ParserRuleReturnScope expr46 =null;
+ ParserRuleReturnScope expr247 =null;
+ ParserRuleReturnScope expr49 =null;
+ ParserRuleReturnScope expr250 =null;
+
+ CommonTree UPLUS45_tree=null;
+ CommonTree UMINUS48_tree=null;
+ RewriteRuleTokenStream stream_UMINUS=new RewriteRuleTokenStream(adaptor,"token UMINUS");
+ RewriteRuleTokenStream stream_UPLUS=new RewriteRuleTokenStream(adaptor,"token UPLUS");
+ RewriteRuleSubtreeStream stream_expr2=new RewriteRuleSubtreeStream(adaptor,"rule expr2");
+ RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:83:5: ( expr2 UPLUS expr -> ^( UPLUS expr2 expr ) | expr2 UMINUS expr -> ^( UMINUS expr2 expr ) | expr2 -> ^( expr2 ) )
+ int alt6=3;
+ switch ( input.LA(1) ) {
+ case FLOATCONST:
+ case INTCONST:
+ {
+ int LA6_1 = input.LA(2);
+ if ( (synpred11_X()) ) {
+ alt6=1;
+ }
+ else if ( (synpred12_X()) ) {
+ alt6=2;
+ }
+ else if ( (true) ) {
+ alt6=3;
+ }
+
+ }
+ break;
+ case UMINUS:
+ {
+ int LA6_2 = input.LA(2);
+ if ( (synpred11_X()) ) {
+ alt6=1;
+ }
+ else if ( (synpred12_X()) ) {
+ alt6=2;
+ }
+ else if ( (true) ) {
+ alt6=3;
+ }
+
+ }
+ break;
+ case STRINGCONST:
+ {
+ int LA6_3 = input.LA(2);
+ if ( (synpred11_X()) ) {
+ alt6=1;
+ }
+ else if ( (synpred12_X()) ) {
+ alt6=2;
+ }
+ else if ( (true) ) {
+ alt6=3;
+ }
+
+ }
+ break;
+ case ID:
+ {
+ int LA6_4 = input.LA(2);
+ if ( (synpred11_X()) ) {
+ alt6=1;
+ }
+ else if ( (synpred12_X()) ) {
+ alt6=2;
+ }
+ else if ( (true) ) {
+ alt6=3;
+ }
+
+ }
+ break;
+ case 23:
+ {
+ int LA6_5 = input.LA(2);
+ if ( (synpred11_X()) ) {
+ alt6=1;
+ }
+ else if ( (synpred12_X()) ) {
+ alt6=2;
+ }
+ else if ( (true) ) {
+ alt6=3;
+ }
+
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 6, 0, input);
+ throw nvae;
+ }
+ switch (alt6) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:83:13: expr2 UPLUS expr
+ {
+ pushFollow(FOLLOW_expr2_in_expr896);
+ expr244=expr2();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr2.add(expr244.getTree());
+ UPLUS45=(Token)match(input,UPLUS,FOLLOW_UPLUS_in_expr898); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_UPLUS.add(UPLUS45);
+
+ pushFollow(FOLLOW_expr_in_expr900);
+ expr46=expr();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr.add(expr46.getTree());
+ // AST REWRITE
+ // elements: UPLUS, expr, expr2
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 83:37: -> ^( UPLUS expr2 expr )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:83:40: ^( UPLUS expr2 expr )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_UPLUS.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_expr2.nextTree());
+ adaptor.addChild(root_1, stream_expr.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:15: expr2 UMINUS expr
+ {
+ pushFollow(FOLLOW_expr2_in_expr933);
+ expr247=expr2();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr2.add(expr247.getTree());
+ UMINUS48=(Token)match(input,UMINUS,FOLLOW_UMINUS_in_expr935); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_UMINUS.add(UMINUS48);
+
+ pushFollow(FOLLOW_expr_in_expr937);
+ expr49=expr();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr.add(expr49.getTree());
+ // AST REWRITE
+ // elements: expr, expr2, UMINUS
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 84:37: -> ^( UMINUS expr2 expr )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:40: ^( UMINUS expr2 expr )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_UMINUS.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_expr2.nextTree());
+ adaptor.addChild(root_1, stream_expr.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 3 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:85:15: expr2
+ {
+ pushFollow(FOLLOW_expr2_in_expr967);
+ expr250=expr2();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr2.add(expr250.getTree());
+ // AST REWRITE
+ // elements: expr2
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 85:37: -> ^( expr2 )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:85:40: ^( expr2 )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_expr2.nextNode(), root_1);
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "expr"
+
+
+ public static class expr2_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "expr2"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86:1: expr2 : ( expr3 UMULTIPLY expr2 -> ^( UMULTIPLY expr3 expr2 ) | expr3 UDIVIDE expr2 -> ^( UDIVIDE expr3 expr2 ) | expr3 -> ^( expr3 ) );
+ public final XParser.expr2_return expr2() throws RecognitionException {
+ XParser.expr2_return retval = new XParser.expr2_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token UMULTIPLY52=null;
+ Token UDIVIDE55=null;
+ ParserRuleReturnScope expr351 =null;
+ ParserRuleReturnScope expr253 =null;
+ ParserRuleReturnScope expr354 =null;
+ ParserRuleReturnScope expr256 =null;
+ ParserRuleReturnScope expr357 =null;
+
+ CommonTree UMULTIPLY52_tree=null;
+ CommonTree UDIVIDE55_tree=null;
+ RewriteRuleTokenStream stream_UDIVIDE=new RewriteRuleTokenStream(adaptor,"token UDIVIDE");
+ RewriteRuleTokenStream stream_UMULTIPLY=new RewriteRuleTokenStream(adaptor,"token UMULTIPLY");
+ RewriteRuleSubtreeStream stream_expr3=new RewriteRuleSubtreeStream(adaptor,"rule expr3");
+ RewriteRuleSubtreeStream stream_expr2=new RewriteRuleSubtreeStream(adaptor,"rule expr2");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86:6: ( expr3 UMULTIPLY expr2 -> ^( UMULTIPLY expr3 expr2 ) | expr3 UDIVIDE expr2 -> ^( UDIVIDE expr3 expr2 ) | expr3 -> ^( expr3 ) )
+ int alt7=3;
+ switch ( input.LA(1) ) {
+ case FLOATCONST:
+ case INTCONST:
+ {
+ int LA7_1 = input.LA(2);
+ if ( (synpred13_X()) ) {
+ alt7=1;
+ }
+ else if ( (synpred14_X()) ) {
+ alt7=2;
+ }
+ else if ( (true) ) {
+ alt7=3;
+ }
+
+ }
+ break;
+ case UMINUS:
+ {
+ int LA7_2 = input.LA(2);
+ if ( (synpred13_X()) ) {
+ alt7=1;
+ }
+ else if ( (synpred14_X()) ) {
+ alt7=2;
+ }
+ else if ( (true) ) {
+ alt7=3;
+ }
+
+ }
+ break;
+ case STRINGCONST:
+ {
+ int LA7_3 = input.LA(2);
+ if ( (synpred13_X()) ) {
+ alt7=1;
+ }
+ else if ( (synpred14_X()) ) {
+ alt7=2;
+ }
+ else if ( (true) ) {
+ alt7=3;
+ }
+
+ }
+ break;
+ case ID:
+ {
+ int LA7_4 = input.LA(2);
+ if ( (synpred13_X()) ) {
+ alt7=1;
+ }
+ else if ( (synpred14_X()) ) {
+ alt7=2;
+ }
+ else if ( (true) ) {
+ alt7=3;
+ }
+
+ }
+ break;
+ case 23:
+ {
+ int LA7_5 = input.LA(2);
+ if ( (synpred13_X()) ) {
+ alt7=1;
+ }
+ else if ( (synpred14_X()) ) {
+ alt7=2;
+ }
+ else if ( (true) ) {
+ alt7=3;
+ }
+
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 7, 0, input);
+ throw nvae;
+ }
+ switch (alt7) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86:13: expr3 UMULTIPLY expr2
+ {
+ pushFollow(FOLLOW_expr3_in_expr21000);
+ expr351=expr3();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr3.add(expr351.getTree());
+ UMULTIPLY52=(Token)match(input,UMULTIPLY,FOLLOW_UMULTIPLY_in_expr21002); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_UMULTIPLY.add(UMULTIPLY52);
+
+ pushFollow(FOLLOW_expr2_in_expr21004);
+ expr253=expr2();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr2.add(expr253.getTree());
+ // AST REWRITE
+ // elements: expr2, expr3, UMULTIPLY
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 86:37: -> ^( UMULTIPLY expr3 expr2 )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86:40: ^( UMULTIPLY expr3 expr2 )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_UMULTIPLY.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_expr3.nextTree());
+ adaptor.addChild(root_1, stream_expr2.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:15: expr3 UDIVIDE expr2
+ {
+ pushFollow(FOLLOW_expr3_in_expr21032);
+ expr354=expr3();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr3.add(expr354.getTree());
+ UDIVIDE55=(Token)match(input,UDIVIDE,FOLLOW_UDIVIDE_in_expr21034); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_UDIVIDE.add(UDIVIDE55);
+
+ pushFollow(FOLLOW_expr2_in_expr21036);
+ expr256=expr2();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr2.add(expr256.getTree());
+ // AST REWRITE
+ // elements: UDIVIDE, expr3, expr2
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 87:37: -> ^( UDIVIDE expr3 expr2 )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:40: ^( UDIVIDE expr3 expr2 )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_UDIVIDE.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_expr3.nextTree());
+ adaptor.addChild(root_1, stream_expr2.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 3 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:88:15: expr3
+ {
+ pushFollow(FOLLOW_expr3_in_expr21064);
+ expr357=expr3();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr3.add(expr357.getTree());
+ // AST REWRITE
+ // elements: expr3
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 88:37: -> ^( expr3 )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:88:40: ^( expr3 )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_expr3.nextNode(), root_1);
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "expr2"
+
+
+ public static class expr3_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "expr3"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:89:1: expr3 : ( number -> ^( number ) | UMINUS number -> ^( UMINUS number ) |t= STRINGCONST |t= ID -> ^( $t) | '(' expr ')' -> ^( expr ) );
+ public final XParser.expr3_return expr3() throws RecognitionException {
+ XParser.expr3_return retval = new XParser.expr3_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token t=null;
+ Token UMINUS59=null;
+ Token char_literal61=null;
+ Token char_literal63=null;
+ ParserRuleReturnScope number58 =null;
+ ParserRuleReturnScope number60 =null;
+ ParserRuleReturnScope expr62 =null;
+
+ CommonTree t_tree=null;
+ CommonTree UMINUS59_tree=null;
+ CommonTree char_literal61_tree=null;
+ CommonTree char_literal63_tree=null;
+ RewriteRuleTokenStream stream_UMINUS=new RewriteRuleTokenStream(adaptor,"token UMINUS");
+ RewriteRuleTokenStream stream_23=new RewriteRuleTokenStream(adaptor,"token 23");
+ RewriteRuleTokenStream stream_24=new RewriteRuleTokenStream(adaptor,"token 24");
+ RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
+ RewriteRuleSubtreeStream stream_number=new RewriteRuleSubtreeStream(adaptor,"rule number");
+ RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:89:6: ( number -> ^( number ) | UMINUS number -> ^( UMINUS number ) |t= STRINGCONST |t= ID -> ^( $t) | '(' expr ')' -> ^( expr ) )
+ int alt8=5;
+ switch ( input.LA(1) ) {
+ case FLOATCONST:
+ case INTCONST:
+ {
+ alt8=1;
+ }
+ break;
+ case UMINUS:
+ {
+ alt8=2;
+ }
+ break;
+ case STRINGCONST:
+ {
+ alt8=3;
+ }
+ break;
+ case ID:
+ {
+ alt8=4;
+ }
+ break;
+ case 23:
+ {
+ alt8=5;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 8, 0, input);
+ throw nvae;
+ }
+ switch (alt8) {
+ case 1 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:89:13: number
+ {
+ pushFollow(FOLLOW_number_in_expr31097);
+ number58=number();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_number.add(number58.getTree());
+ // AST REWRITE
+ // elements: number
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 89:37: -> ^( number )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:89:40: ^( number )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_number.nextNode(), root_1);
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:90:15: UMINUS number
+ {
+ UMINUS59=(Token)match(input,UMINUS,FOLLOW_UMINUS_in_expr31136); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_UMINUS.add(UMINUS59);
+
+ pushFollow(FOLLOW_number_in_expr31138);
+ number60=number();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_number.add(number60.getTree());
+ // AST REWRITE
+ // elements: UMINUS, number
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 90:37: -> ^( UMINUS number )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:90:40: ^( UMINUS number )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_UMINUS.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_number.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 3 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:91:15: t= STRINGCONST
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ t=(Token)match(input,STRINGCONST,FOLLOW_STRINGCONST_in_expr31172); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ t_tree = (CommonTree)adaptor.create(t);
+ adaptor.addChild(root_0, t_tree);
+ }
+
+ }
+ break;
+ case 4 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:91:31: t= ID
+ {
+ t=(Token)match(input,ID,FOLLOW_ID_in_expr31178); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ID.add(t);
+
+ // AST REWRITE
+ // elements: t
+ // token labels: t
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleTokenStream stream_t=new RewriteRuleTokenStream(adaptor,"token t",t);
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 91:37: -> ^( $t)
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:91:40: ^( $t)
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_t.nextNode(), root_1);
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 5 :
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:92:15: '(' expr ')'
+ {
+ char_literal61=(Token)match(input,23,FOLLOW_23_in_expr31202); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_23.add(char_literal61);
+
+ pushFollow(FOLLOW_expr_in_expr31204);
+ expr62=expr();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr.add(expr62.getTree());
+ char_literal63=(Token)match(input,24,FOLLOW_24_in_expr31206); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_24.add(char_literal63);
+
+ // AST REWRITE
+ // elements: expr
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 92:37: -> ^( expr )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:92:40: ^( expr )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_expr.nextNode(), root_1);
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "expr3"
+
+
+ public static class number_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "number"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:93:1: number : ( INTCONST | FLOATCONST );
+ public final XParser.number_return number() throws RecognitionException {
+ XParser.number_return retval = new XParser.number_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token set64=null;
+
+ CommonTree set64_tree=null;
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:93:7: ( INTCONST | FLOATCONST )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ set64=input.LT(1);
+ if ( input.LA(1)==FLOATCONST||input.LA(1)==INTCONST ) {
+ input.consume();
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, (CommonTree)adaptor.create(set64));
+ state.errorRecovery=false;
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ throw mse;
+ }
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "number"
+
+
+ public static class cond_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "cond"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:95:1: cond : expr cond2 -> ^( expr cond2 ) ;
+ public final XParser.cond_return cond() throws RecognitionException {
+ XParser.cond_return retval = new XParser.cond_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope expr65 =null;
+ ParserRuleReturnScope cond266 =null;
+
+ RewriteRuleSubtreeStream stream_cond2=new RewriteRuleSubtreeStream(adaptor,"rule cond2");
+ RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:95:5: ( expr cond2 -> ^( expr cond2 ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:95:13: expr cond2
+ {
+ pushFollow(FOLLOW_expr_in_cond1248);
+ expr65=expr();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr.add(expr65.getTree());
+ pushFollow(FOLLOW_cond2_in_cond1250);
+ cond266=cond2();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_cond2.add(cond266.getTree());
+ // AST REWRITE
+ // elements: cond2, expr
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 95:29: -> ^( expr cond2 )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:95:32: ^( expr cond2 )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_expr.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_cond2.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "cond"
+
+
+ public static class cond2_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "cond2"
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:96:1: cond2 : BINOP expr -> ^( BINOP expr ) ;
+ public final XParser.cond2_return cond2() throws RecognitionException {
+ XParser.cond2_return retval = new XParser.cond2_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token BINOP67=null;
+ ParserRuleReturnScope expr68 =null;
+
+ CommonTree BINOP67_tree=null;
+ RewriteRuleTokenStream stream_BINOP=new RewriteRuleTokenStream(adaptor,"token BINOP");
+ RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
+
+ try {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:96:6: ( BINOP expr -> ^( BINOP expr ) )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:96:13: BINOP expr
+ {
+ BINOP67=(Token)match(input,BINOP,FOLLOW_BINOP_in_cond21274); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_BINOP.add(BINOP67);
+
+ pushFollow(FOLLOW_expr_in_cond21276);
+ expr68=expr();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_expr.add(expr68.getTree());
+ // AST REWRITE
+ // elements: BINOP, expr
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 96:29: -> ^( BINOP expr )
+ {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:96:32: ^( BINOP expr )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_BINOP.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_expr.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
+ }
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "cond2"
+
+ // $ANTLR start synpred10_X
+ public final void synpred10_X_fragment() throws RecognitionException {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:39: ( condElseStat )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:39: condElseStat
+ {
+ pushFollow(FOLLOW_condElseStat_in_synpred10_X762);
+ condElseStat();
+ state._fsp--;
+ if (state.failed) return;
+
+ }
+
+ }
+ // $ANTLR end synpred10_X
+
+ // $ANTLR start synpred11_X
+ public final void synpred11_X_fragment() throws RecognitionException {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:83:13: ( expr2 UPLUS expr )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:83:13: expr2 UPLUS expr
+ {
+ pushFollow(FOLLOW_expr2_in_synpred11_X896);
+ expr2();
+ state._fsp--;
+ if (state.failed) return;
+
+ match(input,UPLUS,FOLLOW_UPLUS_in_synpred11_X898); if (state.failed) return;
+
+ pushFollow(FOLLOW_expr_in_synpred11_X900);
+ expr();
+ state._fsp--;
+ if (state.failed) return;
+
+ }
+
+ }
+ // $ANTLR end synpred11_X
+
+ // $ANTLR start synpred12_X
+ public final void synpred12_X_fragment() throws RecognitionException {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:15: ( expr2 UMINUS expr )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:15: expr2 UMINUS expr
+ {
+ pushFollow(FOLLOW_expr2_in_synpred12_X933);
+ expr2();
+ state._fsp--;
+ if (state.failed) return;
+
+ match(input,UMINUS,FOLLOW_UMINUS_in_synpred12_X935); if (state.failed) return;
+
+ pushFollow(FOLLOW_expr_in_synpred12_X937);
+ expr();
+ state._fsp--;
+ if (state.failed) return;
+
+ }
+
+ }
+ // $ANTLR end synpred12_X
+
+ // $ANTLR start synpred13_X
+ public final void synpred13_X_fragment() throws RecognitionException {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86:13: ( expr3 UMULTIPLY expr2 )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86:13: expr3 UMULTIPLY expr2
+ {
+ pushFollow(FOLLOW_expr3_in_synpred13_X1000);
+ expr3();
+ state._fsp--;
+ if (state.failed) return;
+
+ match(input,UMULTIPLY,FOLLOW_UMULTIPLY_in_synpred13_X1002); if (state.failed) return;
+
+ pushFollow(FOLLOW_expr2_in_synpred13_X1004);
+ expr2();
+ state._fsp--;
+ if (state.failed) return;
+
+ }
+
+ }
+ // $ANTLR end synpred13_X
+
+ // $ANTLR start synpred14_X
+ public final void synpred14_X_fragment() throws RecognitionException {
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:15: ( expr3 UDIVIDE expr2 )
+ // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:15: expr3 UDIVIDE expr2
+ {
+ pushFollow(FOLLOW_expr3_in_synpred14_X1032);
+ expr3();
+ state._fsp--;
+ if (state.failed) return;
+
+ match(input,UDIVIDE,FOLLOW_UDIVIDE_in_synpred14_X1034); if (state.failed) return;
+
+ pushFollow(FOLLOW_expr2_in_synpred14_X1036);
+ expr2();
+ state._fsp--;
+ if (state.failed) return;
+
+ }
+
+ }
+ // $ANTLR end synpred14_X
+
+ // Delegated rules
+
+ public final boolean synpred13_X() {
+ state.backtracking++;
+ int start = input.mark();
+ try {
+ synpred13_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;
+ }
+ public final boolean synpred14_X() {
+ state.backtracking++;
+ int start = input.mark();
+ try {
+ synpred14_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;
+ }
+ public final boolean synpred11_X() {
+ state.backtracking++;
+ int start = input.mark();
+ try {
+ synpred11_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;
+ }
+ public final boolean synpred12_X() {
+ state.backtracking++;
+ int start = input.mark();
+ try {
+ synpred12_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;
+ }
+ public final boolean synpred10_X() {
+ state.backtracking++;
+ int start = input.mark();
+ try {
+ synpred10_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;
+ }
+
+
+
+ public static final BitSet FOLLOW_37_in_program443 = new BitSet(new long[]{0x0000000000000400L});
+ public static final BitSet FOLLOW_ID_in_program445 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_28_in_program447 = new BitSet(new long[]{0x000000D000000000L});
+ public static final BitSet FOLLOW_decllist_in_program449 = new BitSet(new long[]{0x0000000020000000L});
+ public static final BitSet FOLLOW_statlist_in_program451 = new BitSet(new long[]{0x0000000002000000L});
+ public static final BitSet FOLLOW_25_in_program453 = new BitSet(new long[]{0x0000000000000000L});
+ public static final BitSet FOLLOW_EOF_in_program455 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_decl_in_decllist481 = new BitSet(new long[]{0x000000D000000000L});
+ public static final BitSet FOLLOW_decllist_in_decllist483 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_modifier_in_decl509 = new BitSet(new long[]{0x0000000000000400L});
+ public static final BitSet FOLLOW_ID_in_decl511 = new BitSet(new long[]{0x0000000004000000L});
+ public static final BitSet FOLLOW_26_in_decl513 = new BitSet(new long[]{0x0000010900000000L});
+ public static final BitSet FOLLOW_type_in_decl515 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_28_in_decl517 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_39_in_modifier543 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_36_in_modifier549 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_38_in_modifier555 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_35_in_type580 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_32_in_type586 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_40_in_type592 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_29_in_statlist613 = new BitSet(new long[]{0x00000406A0000400L});
+ public static final BitSet FOLLOW_stat_in_statlist616 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_28_in_statlist618 = new BitSet(new long[]{0x00000406A0000400L});
+ public static final BitSet FOLLOW_31_in_statlist622 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_assignstat_in_stat649 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_condstat_in_stat655 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_whilestat_in_stat661 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_forstat_in_stat667 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_statlist_in_stat694 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ID_in_assignstat728 = new BitSet(new long[]{0x0000000008000000L});
+ public static final BitSet FOLLOW_27_in_assignstat730 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr_in_assignstat732 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_34_in_condstat754 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_cond_in_condstat756 = new BitSet(new long[]{0x0000020000000000L});
+ public static final BitSet FOLLOW_41_in_condstat758 = new BitSet(new long[]{0x0000040620000400L});
+ public static final BitSet FOLLOW_stat_in_condstat760 = new BitSet(new long[]{0x0000000040000002L});
+ public static final BitSet FOLLOW_condElseStat_in_condstat762 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_30_in_condElseStat785 = new BitSet(new long[]{0x0000040620000400L});
+ public static final BitSet FOLLOW_stat_in_condElseStat787 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_42_in_whilestat806 = new BitSet(new long[]{0x0000000000800000L});
+ public static final BitSet FOLLOW_23_in_whilestat808 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_cond_in_whilestat810 = new BitSet(new long[]{0x0000000001000000L});
+ public static final BitSet FOLLOW_24_in_whilestat812 = new BitSet(new long[]{0x0000040620000400L});
+ public static final BitSet FOLLOW_stat_in_whilestat814 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_33_in_forstat837 = new BitSet(new long[]{0x0000000000800000L});
+ public static final BitSet FOLLOW_23_in_forstat839 = new BitSet(new long[]{0x0000000000000400L});
+ public static final BitSet FOLLOW_assignstat_in_forstat841 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_28_in_forstat843 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_cond_in_forstat845 = new BitSet(new long[]{0x0000000010000000L});
+ public static final BitSet FOLLOW_28_in_forstat847 = new BitSet(new long[]{0x0000000000000400L});
+ public static final BitSet FOLLOW_assignstat_in_forstat849 = new BitSet(new long[]{0x0000000001000000L});
+ public static final BitSet FOLLOW_24_in_forstat851 = new BitSet(new long[]{0x0000040620000400L});
+ public static final BitSet FOLLOW_stat_in_forstat853 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr2_in_expr896 = new BitSet(new long[]{0x0000000000200000L});
+ public static final BitSet FOLLOW_UPLUS_in_expr898 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr_in_expr900 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr2_in_expr933 = new BitSet(new long[]{0x0000000000080000L});
+ public static final BitSet FOLLOW_UMINUS_in_expr935 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr_in_expr937 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr2_in_expr967 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr3_in_expr21000 = new BitSet(new long[]{0x0000000000100000L});
+ public static final BitSet FOLLOW_UMULTIPLY_in_expr21002 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr2_in_expr21004 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr3_in_expr21032 = new BitSet(new long[]{0x0000000000040000L});
+ public static final BitSet FOLLOW_UDIVIDE_in_expr21034 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr2_in_expr21036 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr3_in_expr21064 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_number_in_expr31097 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_UMINUS_in_expr31136 = new BitSet(new long[]{0x0000000000000A00L});
+ public static final BitSet FOLLOW_number_in_expr31138 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRINGCONST_in_expr31172 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ID_in_expr31178 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_23_in_expr31202 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr_in_expr31204 = new BitSet(new long[]{0x0000000001000000L});
+ public static final BitSet FOLLOW_24_in_expr31206 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr_in_cond1248 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_cond2_in_cond1250 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_BINOP_in_cond21274 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr_in_cond21276 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_condElseStat_in_synpred10_X762 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr2_in_synpred11_X896 = new BitSet(new long[]{0x0000000000200000L});
+ public static final BitSet FOLLOW_UPLUS_in_synpred11_X898 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr_in_synpred11_X900 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr2_in_synpred12_X933 = new BitSet(new long[]{0x0000000000080000L});
+ public static final BitSet FOLLOW_UMINUS_in_synpred12_X935 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr_in_synpred12_X937 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr3_in_synpred13_X1000 = new BitSet(new long[]{0x0000000000100000L});
+ public static final BitSet FOLLOW_UMULTIPLY_in_synpred13_X1002 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr2_in_synpred13_X1004 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_expr3_in_synpred14_X1032 = new BitSet(new long[]{0x0000000000040000L});
+ public static final BitSet FOLLOW_UDIVIDE_in_synpred14_X1034 = new BitSet(new long[]{0x0000000000890E00L});
+ public static final BitSet FOLLOW_expr2_in_synpred14_X1036 = new BitSet(new long[]{0x0000000000000002L});
+}
diff --git a/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g b/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g
index 63a754d..7711ce3 100644
--- a/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g
+++ b/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g
@@ -24,6 +24,18 @@ tokens {
INTCONST;
FLOATCONST;
WS;
+ MODIFIER;
+ UMINUS='-';
+ UPLUS='+';
+ UMULTIPLY='*';
+ UDIVIDE='/';
+ DECLIST;
+ PROGRAM;
+ DECL;
+ TYPE;
+ STAT;
+ STATLIST;
+ EXPR;
}
@parser::header {package de.dhbw.compiler.antlrxparser;}
@@ -35,10 +47,51 @@ ID: ('a'..'z' | 'A'..'Z')
(options {
greedy = true; // Lese alle möglichen Zeichen ein -> Zahlen in ID -> bleibt weiterhin ID
}: 'a'..'z' | 'A'..'Z' | '0'..'9')*;
-INTCONST: ('0'..'9')+;
-FLOATCONST: INTCONST '.' INTCONST;
+
+INTCONST: ('0'..'9')+;
+FLOATCONST: INTCONST '.' INTCONST;
+
+STRINGCONST: '"' (ESCAPE | ~('\\' | '"'))* '"';
+ESCAPE: '\\' ('\"' |'\'' | '\\');
+
+BINOP: '+' | '-' | '*' | '/' | '<' | '>' | '=';
WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); };
-// Parser stuff
-program: 'TODO';
+
+// -- Parser stuff
+program: 'program' ID ';' decllist statlist '.' EOF -> ^(PROGRAM ID decllist statlist);
+
+// Declaration
+decllist: decl decllist -> ^(DECLIST decl decllist);
+decl: modifier ID ':' type ';' -> ^(DECL modifier ID type);
+modifier: mod='read' | mod='print' | mod='read print' -> ^(MODIFIER[mod]);
+type: t='int' | t='float' | t='string' -> ^(TYPE[t]);
+
+// Block
+statlist: 'begin' (stat ';')* 'end' -> ^(STATLIST stat*);
+stat: t=assignstat | t=condstat | t=whilestat | t=forstat -> ^(STAT[t])
+ | statlist
+ -> ^(STATLIST statlist);
+assignstat: ID ':=' expr -> ^(':=' ID expr);
+condstat: 'if' cond 'then' stat condElseStat? -> ^('if' cond stat condElseStat? );
+condElseStat: 'else' stat -> ^('else' stat);
+whilestat: 'while' '(' cond ')' stat -> ^('while' cond stat);
+forstat: 'for' '(' assignstat ';' cond ';' assignstat ')' stat
+ -> ^('for' assignstat cond assignstat stat);
+
+expr: expr2 UPLUS expr -> ^(UPLUS expr2 expr)
+ | expr2 UMINUS expr -> ^(UMINUS expr2 expr)
+ | expr2 -> ^(expr2);
+expr2: expr3 UMULTIPLY expr2 -> ^(UMULTIPLY expr3 expr2)
+ | expr3 UDIVIDE expr2 -> ^(UDIVIDE expr3 expr2)
+ | expr3 -> ^(expr3);
+expr3: number -> ^(number)
+ | UMINUS number -> ^(UMINUS number)
+ | t=STRINGCONST | t=ID -> ^($t)
+ | '(' expr ')' -> ^(expr);
+number: INTCONST | FLOATCONST;
+
+cond: expr cond2 -> ^(expr cond2);
+cond2: BINOP expr -> ^(BINOP expr);
+
diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/X.g b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/X.g
index 63a754d..7711ce3 100644
--- a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/X.g
+++ b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/X.g
@@ -24,6 +24,18 @@ tokens {
INTCONST;
FLOATCONST;
WS;
+ MODIFIER;
+ UMINUS='-';
+ UPLUS='+';
+ UMULTIPLY='*';
+ UDIVIDE='/';
+ DECLIST;
+ PROGRAM;
+ DECL;
+ TYPE;
+ STAT;
+ STATLIST;
+ EXPR;
}
@parser::header {package de.dhbw.compiler.antlrxparser;}
@@ -35,10 +47,51 @@ ID: ('a'..'z' | 'A'..'Z')
(options {
greedy = true; // Lese alle möglichen Zeichen ein -> Zahlen in ID -> bleibt weiterhin ID
}: 'a'..'z' | 'A'..'Z' | '0'..'9')*;
-INTCONST: ('0'..'9')+;
-FLOATCONST: INTCONST '.' INTCONST;
+
+INTCONST: ('0'..'9')+;
+FLOATCONST: INTCONST '.' INTCONST;
+
+STRINGCONST: '"' (ESCAPE | ~('\\' | '"'))* '"';
+ESCAPE: '\\' ('\"' |'\'' | '\\');
+
+BINOP: '+' | '-' | '*' | '/' | '<' | '>' | '=';
WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); };
-// Parser stuff
-program: 'TODO';
+
+// -- Parser stuff
+program: 'program' ID ';' decllist statlist '.' EOF -> ^(PROGRAM ID decllist statlist);
+
+// Declaration
+decllist: decl decllist -> ^(DECLIST decl decllist);
+decl: modifier ID ':' type ';' -> ^(DECL modifier ID type);
+modifier: mod='read' | mod='print' | mod='read print' -> ^(MODIFIER[mod]);
+type: t='int' | t='float' | t='string' -> ^(TYPE[t]);
+
+// Block
+statlist: 'begin' (stat ';')* 'end' -> ^(STATLIST stat*);
+stat: t=assignstat | t=condstat | t=whilestat | t=forstat -> ^(STAT[t])
+ | statlist
+ -> ^(STATLIST statlist);
+assignstat: ID ':=' expr -> ^(':=' ID expr);
+condstat: 'if' cond 'then' stat condElseStat? -> ^('if' cond stat condElseStat? );
+condElseStat: 'else' stat -> ^('else' stat);
+whilestat: 'while' '(' cond ')' stat -> ^('while' cond stat);
+forstat: 'for' '(' assignstat ';' cond ';' assignstat ')' stat
+ -> ^('for' assignstat cond assignstat stat);
+
+expr: expr2 UPLUS expr -> ^(UPLUS expr2 expr)
+ | expr2 UMINUS expr -> ^(UMINUS expr2 expr)
+ | expr2 -> ^(expr2);
+expr2: expr3 UMULTIPLY expr2 -> ^(UMULTIPLY expr3 expr2)
+ | expr3 UDIVIDE expr2 -> ^(UDIVIDE expr3 expr2)
+ | expr3 -> ^(expr3);
+expr3: number -> ^(number)
+ | UMINUS number -> ^(UMINUS number)
+ | t=STRINGCONST | t=ID -> ^($t)
+ | '(' expr ')' -> ^(expr);
+number: INTCONST | FLOATCONST;
+
+cond: expr cond2 -> ^(expr cond2);
+cond2: BINOP expr -> ^(BINOP expr);
+