diff --git a/.idea/modules.xml b/.idea/modules.xml index f77fb4f..a9a5ba8 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -3,6 +3,7 @@ + \ No newline at end of file diff --git a/.idea/runConfigurations/Run_Antlr_builder.xml b/.idea/runConfigurations/Run_Antlr_builder.xml index dd6be14..b4bf6d7 100644 --- a/.idea/runConfigurations/Run_Antlr_builder.xml +++ b/.idea/runConfigurations/Run_Antlr_builder.xml @@ -2,8 +2,8 @@ \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index bb31f4d..514751e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,21 @@ + + - + + + + + + + + + + + - + @@ -65,7 +78,7 @@ - + @@ -146,10 +159,9 @@ - - - + + @@ -166,7 +178,8 @@ 1591172713288 - + + @@ -182,42 +195,52 @@ - + - - + + - - + + + + + + + + + + - - + + - - + + - - + + - - - + + + - - + + + + \ No newline at end of file diff --git a/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens b/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens deleted file mode 100644 index 6d16bd0..0000000 --- a/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens +++ /dev/null @@ -1,63 +0,0 @@ -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 deleted file mode 100644 index de93c5b..0000000 --- a/CC-Praxis-Antlr Parser fuer X-Leer/XLexer.java +++ /dev/null @@ -1,1325 +0,0 @@ -// $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 7711ce3..d6cb0b7 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 @@ -25,10 +25,6 @@ tokens { FLOATCONST; WS; MODIFIER; - UMINUS='-'; - UPLUS='+'; - UMULTIPLY='*'; - UDIVIDE='/'; DECLIST; PROGRAM; DECL; @@ -36,6 +32,7 @@ tokens { STAT; STATLIST; EXPR; + INVALID; } @parser::header {package de.dhbw.compiler.antlrxparser;} @@ -48,31 +45,32 @@ ID: ('a'..'z' | 'A'..'Z') 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' | ('1'..'9') ('0'..'9')*; +FLOATCONST: INTCONST ('.' DIGIT*)? ('e'|'E')('+' |'-' )? INTCONST + | INTCONST ('.' DIGIT*)?; STRINGCONST: '"' (ESCAPE | ~('\\' | '"'))* '"'; ESCAPE: '\\' ('\"' |'\'' | '\\'); -BINOP: '+' | '-' | '*' | '/' | '<' | '>' | '='; +WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); }; -WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); }; +INVALID: .; + +fragment DIGIT: ('0'..'9'); // -- Parser stuff -program: 'program' ID ';' decllist statlist '.' EOF -> ^(PROGRAM ID decllist statlist); +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]); +modifier: 'read' 'print'? | 'read' | 'print'; +type: 'int' | 'float' | 'string'; // Block statlist: 'begin' (stat ';')* 'end' -> ^(STATLIST stat*); -stat: t=assignstat | t=condstat | t=whilestat | t=forstat -> ^(STAT[t]) - | statlist - -> ^(STATLIST statlist); +stat: assignstat | condstat | whilestat | forstat | statlist; assignstat: ID ':=' expr -> ^(':=' ID expr); condstat: 'if' cond 'then' stat condElseStat? -> ^('if' cond stat condElseStat? ); condElseStat: 'else' stat -> ^('else' stat); @@ -80,18 +78,23 @@ 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) +expr: expr2 '+' expr -> ^('+' expr2 expr) + | expr2 '-' expr -> ^('-' expr2 expr) | expr2 -> ^(expr2); -expr2: expr3 UMULTIPLY expr2 -> ^(UMULTIPLY expr3 expr2) - | expr3 UDIVIDE expr2 -> ^(UDIVIDE expr3 expr2) +expr2: expr3 '*' expr2 -> ^('*' expr3 expr2) + | expr3 '/' expr2 -> ^('/' expr3 expr2) | expr3 -> ^(expr3); -expr3: number -> ^(number) - | UMINUS number -> ^(UMINUS number) - | t=STRINGCONST | t=ID -> ^($t) - | '(' expr ')' -> ^(expr); +expr3: number | '-' number | STRINGCONST | '('! expr^ ')'; number: INTCONST | FLOATCONST; -cond: expr cond2 -> ^(expr cond2); -cond2: BINOP expr -> ^(BINOP expr); +compOp: '<' | '>' | '='; +cond: expr cond2; +cond2: compOp expr; +// -- Dummy rules +// Das sollte dafür sorgen, dass implizite Tokens auch ihre Tokens bekommen +// TODO: Remove this +minus: '-'; +div: '/'; +multiply: '*'; +plus: '+'; diff --git a/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.tokens b/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.tokens new file mode 100644 index 0000000..f7075a8 --- /dev/null +++ b/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.tokens @@ -0,0 +1,68 @@ +T__20=20 +T__21=21 +T__22=22 +T__23=23 +T__24=24 +T__25=25 +T__26=26 +T__27=27 +T__28=28 +T__29=29 +T__30=30 +T__31=31 +T__32=32 +T__33=33 +T__34=34 +T__35=35 +T__36=36 +T__37=37 +T__38=38 +T__39=39 +T__40=40 +T__41=41 +T__42=42 +T__43=43 +T__44=44 +T__45=45 +DECL=4 +DECLIST=5 +DIGIT=6 +ESCAPE=7 +EXPR=8 +FLOATCONST=9 +ID=10 +INTCONST=11 +INVALID=12 +MODIFIER=13 +PROGRAM=14 +STAT=15 +STATLIST=16 +STRINGCONST=17 +TYPE=18 +WS=19 +'('=20 +')'=21 +'*'=22 +'+'=23 +'-'=24 +'.'=25 +'/'=26 +':'=27 +':='=28 +';'=29 +'<'=30 +'='=31 +'>'=32 +'begin'=33 +'else'=34 +'end'=35 +'float'=36 +'for'=37 +'if'=38 +'int'=39 +'print'=40 +'program'=41 +'read'=42 +'string'=43 +'then'=44 +'while'=45 diff --git a/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/XLexer.java b/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/XLexer.java index 4e892a5..b3cf828 100644 --- a/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/XLexer.java +++ b/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/XLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.5.2 /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g 2020-06-03 10:22:37 +// $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 14:02:36 package de.dhbw.compiler.antlrxparser; import org.antlr.runtime.*; @@ -9,11 +9,48 @@ import java.util.ArrayList; @SuppressWarnings("all") public class XLexer extends Lexer { public static final int EOF=-1; - public static final int T__8=8; - public static final int FLOATCONST=4; - public static final int ID=5; - public static final int INTCONST=6; - public static final int WS=7; + public static final int T__20=20; + public static final int T__21=21; + public static final int T__22=22; + public static final int T__23=23; + public static final int T__24=24; + public static final int T__25=25; + public static final int T__26=26; + public static final int T__27=27; + public static final int T__28=28; + public static final int T__29=29; + public static final int T__30=30; + public static final int T__31=31; + public static final int T__32=32; + public static final int T__33=33; + public static final int T__34=34; + public static final int T__35=35; + public static final int T__36=36; + public static final int T__37=37; + public static final int T__38=38; + public static final int T__39=39; + public static final int T__40=40; + public static final int T__41=41; + public static final int T__42=42; + public static final int T__43=43; + public static final int T__44=44; + public static final int T__45=45; + public static final int DECL=4; + public static final int DECLIST=5; + public static final int DIGIT=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 INVALID=12; + public static final int MODIFIER=13; + public static final int PROGRAM=14; + public static final int STAT=15; + public static final int STATLIST=16; + public static final int STRINGCONST=17; + public static final int TYPE=18; + public static final int WS=19; // delegates // delegators @@ -28,17 +65,177 @@ public class XLexer extends Lexer { public XLexer(CharStream input, RecognizerSharedState state) { super(input,state); } - @Override public String getGrammarFileName() { return "/Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g"; } + @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 "T__8" - public final void mT__8() throws RecognitionException { + // $ANTLR start "T__20" + public final void mT__20() throws RecognitionException { try { - int _type = T__8; + int _type = T__20; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:9:6: ( 'TODO' ) - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:9:8: 'TODO' + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:9:7: ( '(' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:9:9: '(' { - match("TODO"); + match('('); + } + + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + // $ANTLR end "T__20" + + // $ANTLR start "T__21" + public final void mT__21() throws RecognitionException { + try { + int _type = T__21; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:10:7: ( ')' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:10:9: ')' + { + match(')'); + } + + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + // $ANTLR end "T__21" + + // $ANTLR start "T__22" + public final void mT__22() throws RecognitionException { + try { + int _type = T__22; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:11:7: ( '*' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:11:9: '*' + { + match('*'); + } + + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + // $ANTLR end "T__22" + + // $ANTLR start "T__23" + public final void mT__23() throws RecognitionException { + try { + int _type = T__23; + int _channel = DEFAULT_TOKEN_CHANNEL; + // 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 "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: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__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: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__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: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__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: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__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:17:7: ( ':=' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:17:9: ':=' + { + match(":="); } @@ -49,15 +246,368 @@ public class XLexer extends Lexer { // do for sure before leaving } } - // $ANTLR end "T__8" + // $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: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__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:19:7: ( '<' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:19:9: '<' + { + match('<'); + } + + 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:20:7: ( '=' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:20:9: '=' + { + match('='); + } + + 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:21:7: ( '>' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:21:9: '>' + { + match('>'); + } + + 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:22:7: ( 'begin' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:22:9: 'begin' + { + match("begin"); + + } + + 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:23:7: ( 'else' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:23:9: 'else' + { + match("else"); + + } + + 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:24:7: ( 'end' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:24:9: 'end' + { + match("end"); + + } + + 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:25:7: ( 'float' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:25:9: 'float' + { + match("float"); + + } + + 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:26:7: ( 'for' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:26:9: 'for' + { + match("for"); + + } + + 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:27:7: ( 'if' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:27:9: 'if' + { + match("if"); + + } + + 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:28:7: ( 'int' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:28:9: 'int' + { + match("int"); + + } + + 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:29:7: ( 'print' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:29:9: 'print' + { + match("print"); + + } + + 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:30:7: ( 'program' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:30:9: 'program' + { + match("program"); + + } + + 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:31:7: ( 'read' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:31:9: 'read' + { + match("read"); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + // $ANTLR end "T__42" + + // $ANTLR start "T__43" + public final void mT__43() throws RecognitionException { + try { + int _type = T__43; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:32:7: ( 'string' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:32:9: 'string' + { + match("string"); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + // $ANTLR end "T__43" + + // $ANTLR start "T__44" + public final void mT__44() throws RecognitionException { + try { + int _type = T__44; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:33:7: ( 'then' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:33:9: 'then' + { + match("then"); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + // $ANTLR end "T__44" + + // $ANTLR start "T__45" + public final void mT__45() throws RecognitionException { + try { + int _type = T__45; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:34:7: ( 'while' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:34:9: 'while' + { + match("while"); + + } + + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + // $ANTLR end "T__45" // $ANTLR start "ID" public final void mID() throws RecognitionException { try { int _type = ID; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:34:3: ( ( 'a' .. 'z' | 'A' .. 'Z' ) ( options {greedy=true; } : 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' )* ) - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:34:13: ( '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:43: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:43: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(); @@ -67,7 +617,7 @@ public class XLexer extends Lexer { recover(mse); throw mse; } - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:35:13: ( 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:44:13: ( options {greedy=true; } : 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' )* loop1: while (true) { int alt1=4; @@ -149,19 +699,19 @@ public class XLexer extends Lexer { } switch (alt1) { case 1 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:37:16: 'a' .. 'z' + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:46:16: 'a' .. 'z' { matchRange('a','z'); } break; case 2 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:37:27: 'A' .. 'Z' + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:46:27: 'A' .. 'Z' { matchRange('A','Z'); } break; case 3 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:37:38: '0' .. '9' + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:46:38: '0' .. '9' { matchRange('0','9'); } @@ -188,24 +738,33 @@ public class XLexer extends Lexer { try { int _type = INTCONST; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:38:9: ( ( '0' .. '9' )+ ) - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:38:13: ( '0' .. '9' )+ - { - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:38:13: ( '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; - } + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:48:9: ( '0' | ( '1' .. '9' ) ( '0' .. '9' )* ) + int alt3=2; + int LA3_0 = input.LA(1); + if ( (LA3_0=='0') ) { + alt3=1; + } + else if ( ((LA3_0 >= '1' && LA3_0 <= '9')) ) { + alt3=2; + } - switch (alt2) { + else { + NoViableAltException nvae = + new NoViableAltException("", 3, 0, input); + throw nvae; + } + + switch (alt3) { case 1 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g: + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:48:17: '0' { - if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) { + match('0'); + } + break; + case 2 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:48:23: ( '1' .. '9' ) ( '0' .. '9' )* + { + if ( (input.LA(1) >= '1' && input.LA(1) <= '9') ) { input.consume(); } else { @@ -213,19 +772,39 @@ public class XLexer extends Lexer { recover(mse); throw mse; } + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:48:34: ( '0' .. '9' )* + 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 : + break loop2; + } + } + } break; - default : - if ( cnt2 >= 1 ) break loop2; - EarlyExitException eee = new EarlyExitException(2, input); - throw eee; - } - cnt2++; } - - } - state.type = _type; state.channel = _channel; } @@ -240,16 +819,149 @@ public class XLexer extends Lexer { try { int _type = FLOATCONST; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:39:11: ( INTCONST '.' INTCONST ) - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:39:13: INTCONST '.' INTCONST - { - mINTCONST(); + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:11: ( INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST | INTCONST ( '.' ( DIGIT )* )? ) + int alt9=2; + alt9 = dfa9.predict(input); + switch (alt9) { + case 1 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:17: INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST + { + mINTCONST(); - match('.'); - mINTCONST(); + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:26: ( '.' ( DIGIT )* )? + int alt5=2; + int LA5_0 = input.LA(1); + if ( (LA5_0=='.') ) { + alt5=1; + } + switch (alt5) { + case 1 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:27: '.' ( DIGIT )* + { + match('.'); + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:31: ( DIGIT )* + loop4: + while (true) { + int alt4=2; + int LA4_0 = input.LA(1); + if ( ((LA4_0 >= '0' && LA4_0 <= '9')) ) { + alt4=1; + } + + switch (alt4) { + case 1 : + // 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 : + break loop4; + } + } + + } + break; + + } + + if ( input.LA(1)=='E'||input.LA(1)=='e' ) { + 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:49:49: ( '+' | '-' )? + int alt6=2; + int LA6_0 = input.LA(1); + if ( (LA6_0=='+'||LA6_0=='-') ) { + alt6=1; + } + switch (alt6) { + case 1 : + // 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.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse; + } + } + break; + + } + + mINTCONST(); + + } + break; + case 2 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:50:19: INTCONST ( '.' ( DIGIT )* )? + { + mINTCONST(); + + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:50:28: ( '.' ( DIGIT )* )? + int alt8=2; + int LA8_0 = input.LA(1); + if ( (LA8_0=='.') ) { + alt8=1; + } + switch (alt8) { + case 1 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:50:29: '.' ( DIGIT )* + { + match('.'); + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:50:33: ( DIGIT )* + loop7: + while (true) { + int alt7=2; + int LA7_0 = input.LA(1); + if ( ((LA7_0 >= '0' && LA7_0 <= '9')) ) { + alt7=1; + } + + switch (alt7) { + 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 : + break loop7; + } + } + + } + break; + + } + + } + break; } - state.type = _type; state.channel = _channel; } @@ -259,27 +971,115 @@ public class XLexer extends Lexer { } // $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:52:12: ( '\"' ( ESCAPE |~ ( '\\\\' | '\"' ) )* '\"' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:52:17: '\"' ( ESCAPE |~ ( '\\\\' | '\"' ) )* '\"' + { + match('\"'); + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:52:21: ( ESCAPE |~ ( '\\\\' | '\"' ) )* + loop10: + while (true) { + int alt10=3; + int LA10_0 = input.LA(1); + if ( (LA10_0=='\\') ) { + alt10=1; + } + else if ( ((LA10_0 >= '\u0000' && LA10_0 <= '!')||(LA10_0 >= '#' && LA10_0 <= '[')||(LA10_0 >= ']' && LA10_0 <= '\uFFFF')) ) { + alt10=2; + } + + switch (alt10) { + case 1 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:52:22: ESCAPE + { + mESCAPE(); + + } + break; + case 2 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:52: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 loop10; + } + } + + 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:53:7: ( '\\\\' ( '\\\"' | '\\'' | '\\\\' ) ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:53: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 "WS" public final void mWS() throws RecognitionException { try { int _type = WS; int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:41:3: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ ) - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:41:13: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:55:3: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:55:17: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ { - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:41:13: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ - int cnt3=0; - loop3: + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:55:17: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ + int cnt11=0; + loop11: while (true) { - int alt3=2; - int LA3_0 = input.LA(1); - if ( ((LA3_0 >= '\t' && LA3_0 <= '\n')||(LA3_0 >= '\f' && LA3_0 <= '\r')||LA3_0==' ') ) { - alt3=1; + int alt11=2; + int LA11_0 = input.LA(1); + if ( ((LA11_0 >= '\t' && LA11_0 <= '\n')||(LA11_0 >= '\f' && LA11_0 <= '\r')||LA11_0==' ') ) { + alt11=1; } - switch (alt3) { + switch (alt11) { case 1 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g: + // 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(); @@ -293,11 +1093,11 @@ public class XLexer extends Lexer { break; default : - if ( cnt3 >= 1 ) break loop3; - EarlyExitException eee = new EarlyExitException(3, input); + if ( cnt11 >= 1 ) break loop11; + EarlyExitException eee = new EarlyExitException(11, input); throw eee; } - cnt3++; + cnt11++; } skip(); @@ -312,45 +1112,284 @@ public class XLexer extends Lexer { } // $ANTLR end "WS" + // $ANTLR start "INVALID" + public final void mINVALID() throws RecognitionException { + try { + int _type = INVALID; + int _channel = DEFAULT_TOKEN_CHANNEL; + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:57:8: ( . ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:57:17: . + { + matchAny(); + } + + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + // $ANTLR end "INVALID" + + // $ANTLR start "DIGIT" + public final void mDIGIT() throws RecognitionException { + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:59:15: ( ( '0' .. '9' ) ) + // 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; + } + } + + } + finally { + // do for sure before leaving + } + } + // $ANTLR end "DIGIT" + @Override public void mTokens() throws RecognitionException { - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:1:8: ( T__8 | ID | INTCONST | FLOATCONST | WS ) - int alt4=5; - alt4 = dfa4.predict(input); - switch (alt4) { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:8: ( T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | ID | INTCONST | FLOATCONST | STRINGCONST | ESCAPE | WS | INVALID ) + int alt12=33; + alt12 = dfa12.predict(input); + switch (alt12) { case 1 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:1:10: T__8 + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:10: T__20 { - mT__8(); + mT__20(); } break; case 2 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:1:15: ID + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:16: T__21 + { + mT__21(); + + } + break; + case 3 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:22: T__22 + { + mT__22(); + + } + break; + case 4 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:28: T__23 + { + mT__23(); + + } + break; + case 5 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:34: T__24 + { + mT__24(); + + } + break; + case 6 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:40: T__25 + { + mT__25(); + + } + break; + case 7 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:46: T__26 + { + mT__26(); + + } + break; + case 8 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:52: T__27 + { + mT__27(); + + } + break; + case 9 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:58: T__28 + { + mT__28(); + + } + break; + case 10 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:64: T__29 + { + mT__29(); + + } + break; + case 11 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:70: T__30 + { + mT__30(); + + } + break; + case 12 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:76: T__31 + { + mT__31(); + + } + break; + case 13 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:82: T__32 + { + mT__32(); + + } + break; + case 14 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:88: T__33 + { + mT__33(); + + } + break; + case 15 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:94: T__34 + { + mT__34(); + + } + break; + case 16 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:100: T__35 + { + mT__35(); + + } + break; + case 17 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:106: T__36 + { + mT__36(); + + } + break; + case 18 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:112: T__37 + { + mT__37(); + + } + break; + case 19 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:118: T__38 + { + mT__38(); + + } + break; + case 20 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:124: T__39 + { + mT__39(); + + } + break; + case 21 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:130: T__40 + { + mT__40(); + + } + break; + case 22 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:136: T__41 + { + mT__41(); + + } + break; + case 23 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:142: T__42 + { + mT__42(); + + } + break; + case 24 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:148: T__43 + { + mT__43(); + + } + break; + case 25 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:154: T__44 + { + mT__44(); + + } + break; + case 26 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:160: T__45 + { + mT__45(); + + } + break; + case 27 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:166: ID { mID(); } break; - case 3 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:1:18: INTCONST + case 28 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:169: INTCONST { mINTCONST(); } break; - case 4 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:1:27: FLOATCONST + case 29 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:178: FLOATCONST { mFLOATCONST(); } break; - case 5 : - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:1:38: WS + case 30 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:189: STRINGCONST + { + mSTRINGCONST(); + + } + break; + case 31 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:201: ESCAPE + { + mESCAPE(); + + } + break; + case 32 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:208: WS { mWS(); + } + break; + case 33 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:211: INVALID + { + mINVALID(); + } break; @@ -358,66 +1397,292 @@ public class XLexer extends Lexer { } - protected DFA4 dfa4 = new DFA4(this); - static final String DFA4_eotS = - "\1\uffff\1\2\1\uffff\1\6\1\uffff\1\2\2\uffff\1\2\1\12\1\uffff"; - static final String DFA4_eofS = - "\13\uffff"; - static final String DFA4_minS = - "\1\11\1\117\1\uffff\1\56\1\uffff\1\104\2\uffff\1\117\1\60\1\uffff"; - static final String DFA4_maxS = - "\1\172\1\117\1\uffff\1\71\1\uffff\1\104\2\uffff\1\117\1\172\1\uffff"; - static final String DFA4_acceptS = - "\2\uffff\1\2\1\uffff\1\5\1\uffff\1\3\1\4\2\uffff\1\1"; - static final String DFA4_specialS = - "\13\uffff}>"; - static final String[] DFA4_transitionS = { - "\2\4\1\uffff\2\4\22\uffff\1\4\17\uffff\12\3\7\uffff\23\2\1\1\6\2\6\uffff"+ - "\32\2", - "\1\5", + protected DFA9 dfa9 = new DFA9(this); + protected DFA12 dfa12 = new DFA12(this); + static final String DFA9_eotS = + "\1\uffff\2\3\1\uffff\1\3\1\uffff\2\3"; + static final String DFA9_eofS = + "\10\uffff"; + static final String DFA9_minS = + "\1\60\2\56\1\uffff\1\60\1\uffff\1\56\1\60"; + static final String DFA9_maxS = + "\1\71\2\145\1\uffff\1\145\1\uffff\2\145"; + static final String DFA9_acceptS = + "\3\uffff\1\2\1\uffff\1\1\2\uffff"; + static final String DFA9_specialS = + "\10\uffff}>"; + static final String[] DFA9_transitionS = { + "\1\1\11\2", + "\1\4\26\uffff\1\5\37\uffff\1\5", + "\1\4\1\uffff\12\6\13\uffff\1\5\37\uffff\1\5", "", - "\1\7\1\uffff\12\3", + "\12\7\13\uffff\1\5\37\uffff\1\5", "", - "\1\10", - "", - "", - "\1\11", - "\12\2\7\uffff\32\2\6\uffff\32\2", - "" + "\1\4\1\uffff\12\6\13\uffff\1\5\37\uffff\1\5", + "\12\7\13\uffff\1\5\37\uffff\1\5" }; - static final short[] DFA4_eot = DFA.unpackEncodedString(DFA4_eotS); - static final short[] DFA4_eof = DFA.unpackEncodedString(DFA4_eofS); - static final char[] DFA4_min = DFA.unpackEncodedStringToUnsignedChars(DFA4_minS); - static final char[] DFA4_max = DFA.unpackEncodedStringToUnsignedChars(DFA4_maxS); - static final short[] DFA4_accept = DFA.unpackEncodedString(DFA4_acceptS); - static final short[] DFA4_special = DFA.unpackEncodedString(DFA4_specialS); - static final short[][] DFA4_transition; + static final short[] DFA9_eot = DFA.unpackEncodedString(DFA9_eotS); + static final short[] DFA9_eof = DFA.unpackEncodedString(DFA9_eofS); + static final char[] DFA9_min = DFA.unpackEncodedStringToUnsignedChars(DFA9_minS); + static final char[] DFA9_max = DFA.unpackEncodedStringToUnsignedChars(DFA9_maxS); + static final short[] DFA9_accept = DFA.unpackEncodedString(DFA9_acceptS); + static final short[] DFA9_special = DFA.unpackEncodedString(DFA9_specialS); + static final short[][] DFA9_transition; static { - int numStates = DFA4_transitionS.length; - DFA4_transition = new short[numStates][]; + int numStates = DFA9_transitionS.length; + DFA9_transition = new short[numStates][]; for (int i=0; i"; + static final String[] DFA12_transitionS = { + "\11\34\2\33\1\34\2\33\22\34\1\33\1\34\1\31\5\34\1\1\1\2\1\3\1\4\1\34"+ + "\1\5\1\6\1\7\1\27\11\30\1\10\1\11\1\12\1\13\1\14\2\34\32\26\1\34\1\32"+ + "\4\34\1\26\1\15\2\26\1\16\1\17\2\26\1\20\6\26\1\21\1\26\1\22\1\23\1\24"+ + "\2\26\1\25\3\26\uff85\34", + "", + "", + "", + "", + "", + "", + "", + "\1\44", + "", + "", + "", + "", + "\1\52", + "\1\54\1\uffff\1\55", + "\1\56\2\uffff\1\57", + "\1\60\7\uffff\1\61", + "\1\62", + "\1\63", + "\1\64", + "\1\65", + "\1\66", + "", + "\1\70\26\uffff\1\70\37\uffff\1\70", + "\1\70\1\uffff\12\71\13\uffff\1\70\37\uffff\1\70", + "\0\72", + "\1\73\4\uffff\1\73\64\uffff\1\73", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "\1\75", + "", + "\1\76", + "\1\77", + "\1\100", + "\1\101", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "\1\103", + "\1\104\5\uffff\1\105", + "\1\106", + "\1\107", + "\1\110", + "\1\111", + "", + "", + "\1\70\1\uffff\12\71\13\uffff\1\70\37\uffff\1\70", + "", + "", + "", + "\1\112", + "\1\113", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "\1\115", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "\1\120", + "\1\121", + "\1\122", + "\1\123", + "\1\124", + "\1\125", + "\1\126", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "", + "\1\130", + "", + "", + "\1\131", + "\1\132", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "\1\134", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "\1\136", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "\1\142", + "", + "\1\143", + "", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "", + "", + "", + "\1\145", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "", + "\12\53\7\uffff\32\53\6\uffff\32\53", + "", + "" + }; + + static final short[] DFA12_eot = DFA.unpackEncodedString(DFA12_eotS); + static final short[] DFA12_eof = DFA.unpackEncodedString(DFA12_eofS); + static final char[] DFA12_min = DFA.unpackEncodedStringToUnsignedChars(DFA12_minS); + static final char[] DFA12_max = DFA.unpackEncodedStringToUnsignedChars(DFA12_maxS); + static final short[] DFA12_accept = DFA.unpackEncodedString(DFA12_acceptS); + static final short[] DFA12_special = DFA.unpackEncodedString(DFA12_specialS); + static final short[][] DFA12_transition; + + static { + int numStates = DFA12_transitionS.length; + DFA12_transition = new short[numStates][]; + for (int i=0; i= '\u0000' && LA12_25 <= '\uFFFF')) ) {s = 58;} + else s = 28; + if ( s>=0 ) return s; + break; + + case 1 : + int LA12_0 = input.LA(1); + s = -1; + if ( (LA12_0=='(') ) {s = 1;} + else if ( (LA12_0==')') ) {s = 2;} + else if ( (LA12_0=='*') ) {s = 3;} + else if ( (LA12_0=='+') ) {s = 4;} + else if ( (LA12_0=='-') ) {s = 5;} + else if ( (LA12_0=='.') ) {s = 6;} + else if ( (LA12_0=='/') ) {s = 7;} + else if ( (LA12_0==':') ) {s = 8;} + else if ( (LA12_0==';') ) {s = 9;} + else if ( (LA12_0=='<') ) {s = 10;} + else if ( (LA12_0=='=') ) {s = 11;} + else if ( (LA12_0=='>') ) {s = 12;} + else if ( (LA12_0=='b') ) {s = 13;} + else if ( (LA12_0=='e') ) {s = 14;} + else if ( (LA12_0=='f') ) {s = 15;} + else if ( (LA12_0=='i') ) {s = 16;} + else if ( (LA12_0=='p') ) {s = 17;} + else if ( (LA12_0=='r') ) {s = 18;} + else if ( (LA12_0=='s') ) {s = 19;} + else if ( (LA12_0=='t') ) {s = 20;} + else if ( (LA12_0=='w') ) {s = 21;} + else if ( ((LA12_0 >= 'A' && LA12_0 <= 'Z')||LA12_0=='a'||(LA12_0 >= 'c' && LA12_0 <= 'd')||(LA12_0 >= 'g' && LA12_0 <= 'h')||(LA12_0 >= 'j' && LA12_0 <= 'o')||LA12_0=='q'||(LA12_0 >= 'u' && LA12_0 <= 'v')||(LA12_0 >= 'x' && LA12_0 <= 'z')) ) {s = 22;} + else if ( (LA12_0=='0') ) {s = 23;} + else if ( ((LA12_0 >= '1' && LA12_0 <= '9')) ) {s = 24;} + else if ( (LA12_0=='\"') ) {s = 25;} + else if ( (LA12_0=='\\') ) {s = 26;} + else if ( ((LA12_0 >= '\t' && LA12_0 <= '\n')||(LA12_0 >= '\f' && LA12_0 <= '\r')||LA12_0==' ') ) {s = 27;} + else if ( ((LA12_0 >= '\u0000' && LA12_0 <= '\b')||LA12_0=='\u000B'||(LA12_0 >= '\u000E' && LA12_0 <= '\u001F')||LA12_0=='!'||(LA12_0 >= '#' && LA12_0 <= '\'')||LA12_0==','||(LA12_0 >= '?' && LA12_0 <= '@')||LA12_0=='['||(LA12_0 >= ']' && LA12_0 <= '`')||(LA12_0 >= '{' && LA12_0 <= '\uFFFF')) ) {s = 28;} + if ( s>=0 ) return s; + break; + } + NoViableAltException nvae = + new NoViableAltException(getDescription(), 12, _s, input); + error(nvae); + throw nvae; } } diff --git a/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/XParser.java b/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/XParser.java index 6584c8e..adbdfb2 100644 --- a/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/XParser.java +++ b/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/XParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.5.2 /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g 2020-06-03 10:22:37 +// $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 14:02:36 package de.dhbw.compiler.antlrxparser; import org.antlr.runtime.*; @@ -14,15 +14,56 @@ import org.antlr.runtime.tree.*; @SuppressWarnings("all") public class XParser extends Parser { public static final String[] tokenNames = new String[] { - "", "", "", "", "FLOATCONST", "ID", "INTCONST", - "WS", "'TODO'" + "", "", "", "", "DECL", "DECLIST", "DIGIT", "ESCAPE", + "EXPR", "FLOATCONST", "ID", "INTCONST", "INVALID", "MODIFIER", "PROGRAM", + "STAT", "STATLIST", "STRINGCONST", "TYPE", "WS", "'('", "')'", "'*'", + "'+'", "'-'", "'.'", "'/'", "':'", "':='", "';'", "'<'", "'='", "'>'", + "'begin'", "'else'", "'end'", "'float'", "'for'", "'if'", "'int'", "'print'", + "'program'", "'read'", "'string'", "'then'", "'while'" }; public static final int EOF=-1; - public static final int T__8=8; - public static final int FLOATCONST=4; - public static final int ID=5; - public static final int INTCONST=6; - public static final int WS=7; + public static final int T__20=20; + public static final int T__21=21; + public static final int T__22=22; + public static final int T__23=23; + public static final int T__24=24; + public static final int T__25=25; + public static final int T__26=26; + public static final int T__27=27; + public static final int T__28=28; + public static final int T__29=29; + public static final int T__30=30; + public static final int T__31=31; + public static final int T__32=32; + public static final int T__33=33; + public static final int T__34=34; + public static final int T__35=35; + public static final int T__36=36; + public static final int T__37=37; + public static final int T__38=38; + public static final int T__39=39; + public static final int T__40=40; + public static final int T__41=41; + public static final int T__42=42; + public static final int T__43=43; + public static final int T__44=44; + public static final int T__45=45; + public static final int DECL=4; + public static final int DECLIST=5; + public static final int DIGIT=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 INVALID=12; + public static final int MODIFIER=13; + public static final int PROGRAM=14; + public static final int STAT=15; + public static final int STATLIST=16; + public static final int STRINGCONST=17; + public static final int TYPE=18; + public static final int WS=19; // delegates public Parser[] getDelegates() { @@ -48,7 +89,7 @@ public class XParser extends Parser { return adaptor; } @Override public String[] getTokenNames() { return XParser.tokenNames; } - @Override public String getGrammarFileName() { return "/Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g"; } + @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 { @@ -59,7 +100,7 @@ public class XParser extends Parser { // $ANTLR start "program" - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:44:1: program : 'TODO' ; + // 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); @@ -67,20 +108,83 @@ public class XParser extends Parser { 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_29=new RewriteRuleTokenStream(adaptor,"token 29"); + RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); + RewriteRuleTokenStream stream_41=new RewriteRuleTokenStream(adaptor,"token 41"); + RewriteRuleTokenStream stream_EOF=new RewriteRuleTokenStream(adaptor,"token EOF"); + RewriteRuleSubtreeStream stream_decllist=new RewriteRuleSubtreeStream(adaptor,"rule decllist"); + RewriteRuleSubtreeStream stream_statlist=new RewriteRuleSubtreeStream(adaptor,"rule statlist"); try { - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:44:8: ( 'TODO' ) - // /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:44:13: 'TODO' + // 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:17: 'program' ID ';' decllist statlist '.' EOF { - root_0 = (CommonTree)adaptor.nil(); + string_literal1=(Token)match(input,41,FOLLOW_41_in_program473); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_41.add(string_literal1); + ID2=(Token)match(input,ID,FOLLOW_ID_in_program475); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_ID.add(ID2); - string_literal1=(Token)match(input,8,FOLLOW_8_in_program272); if (state.failed) return retval; + char_literal3=(Token)match(input,29,FOLLOW_29_in_program477); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_29.add(char_literal3); + + pushFollow(FOLLOW_decllist_in_program479); + decllist4=decllist(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_decllist.add(decllist4.getTree()); + pushFollow(FOLLOW_statlist_in_program481); + 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_program483); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_25.add(char_literal6); + + EOF7=(Token)match(input,EOF,FOLLOW_EOF_in_program485); 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 ) { - string_literal1_tree = (CommonTree)adaptor.create(string_literal1); - adaptor.addChild(root_0, string_literal1_tree); + retval.tree = root_0; + RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); + + root_0 = (CommonTree)adaptor.nil(); + // 63:60: -> ^( PROGRAM ID decllist statlist ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:63:63: ^( 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; } } @@ -104,9 +208,2673 @@ public class XParser extends Parser { } // $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_decllist511); + decl8=decl(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_decl.add(decl8.getTree()); + pushFollow(FOLLOW_decllist_in_decllist513); + 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_27=new RewriteRuleTokenStream(adaptor,"token 27"); + RewriteRuleTokenStream stream_29=new RewriteRuleTokenStream(adaptor,"token 29"); + 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_decl539); + 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_decl541); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_ID.add(ID11); + + char_literal12=(Token)match(input,27,FOLLOW_27_in_decl543); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_27.add(char_literal12); + + pushFollow(FOLLOW_type_in_decl545); + type13=type(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_type.add(type13.getTree()); + char_literal14=(Token)match(input,29,FOLLOW_29_in_decl547); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_29.add(char_literal14); + + // AST REWRITE + // elements: modifier, type, 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 : ( 'read' ( 'print' )? | 'read' | 'print' ); + 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 string_literal15=null; + Token string_literal16=null; + Token string_literal17=null; + Token string_literal18=null; + + CommonTree string_literal15_tree=null; + CommonTree string_literal16_tree=null; + CommonTree string_literal17_tree=null; + CommonTree string_literal18_tree=null; + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:9: ( 'read' ( 'print' )? | 'read' | 'print' ) + int alt2=3; + int LA2_0 = input.LA(1); + if ( (LA2_0==42) ) { + int LA2_1 = input.LA(2); + if ( (synpred2_X()) ) { + alt2=1; + } + else if ( (synpred3_X()) ) { + alt2=2; + } + + else { + if (state.backtracking>0) {state.failed=true; return retval;} + int nvaeMark = input.mark(); + try { + input.consume(); + NoViableAltException nvae = + new NoViableAltException("", 2, 1, input); + throw nvae; + } finally { + input.rewind(nvaeMark); + } + } + + } + else if ( (LA2_0==40) ) { + alt2=3; + } + + else { + 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:68:17: 'read' ( 'print' )? + { + root_0 = (CommonTree)adaptor.nil(); + + + string_literal15=(Token)match(input,42,FOLLOW_42_in_modifier571); if (state.failed) return retval; + if ( state.backtracking==0 ) { + string_literal15_tree = (CommonTree)adaptor.create(string_literal15); + adaptor.addChild(root_0, string_literal15_tree); + } + + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:24: ( 'print' )? + int alt1=2; + int LA1_0 = input.LA(1); + if ( (LA1_0==40) ) { + alt1=1; + } + switch (alt1) { + case 1 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:24: 'print' + { + string_literal16=(Token)match(input,40,FOLLOW_40_in_modifier573); if (state.failed) return retval; + if ( state.backtracking==0 ) { + string_literal16_tree = (CommonTree)adaptor.create(string_literal16); + adaptor.addChild(root_0, string_literal16_tree); + } + + } + break; + + } + + } + break; + case 2 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:35: 'read' + { + root_0 = (CommonTree)adaptor.nil(); + + + string_literal17=(Token)match(input,42,FOLLOW_42_in_modifier578); if (state.failed) return retval; + if ( state.backtracking==0 ) { + string_literal17_tree = (CommonTree)adaptor.create(string_literal17); + adaptor.addChild(root_0, string_literal17_tree); + } + + } + break; + case 3 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:44: 'print' + { + root_0 = (CommonTree)adaptor.nil(); + + + string_literal18=(Token)match(input,40,FOLLOW_40_in_modifier582); if (state.failed) return retval; + if ( state.backtracking==0 ) { + string_literal18_tree = (CommonTree)adaptor.create(string_literal18); + adaptor.addChild(root_0, string_literal18_tree); + } + + } + 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 : ( 'int' | 'float' | 'string' ); + 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 set19=null; + + CommonTree set19_tree=null; + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:69:5: ( 'int' | 'float' | 'string' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g: + { + root_0 = (CommonTree)adaptor.nil(); + + + set19=input.LT(1); + if ( input.LA(1)==36||input.LA(1)==39||input.LA(1)==43 ) { + input.consume(); + if ( state.backtracking==0 ) adaptor.addChild(root_0, (CommonTree)adaptor.create(set19)); + 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 "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_literal20=null; + Token char_literal22=null; + Token string_literal23=null; + ParserRuleReturnScope stat21 =null; + + CommonTree string_literal20_tree=null; + CommonTree char_literal22_tree=null; + CommonTree string_literal23_tree=null; + RewriteRuleTokenStream stream_33=new RewriteRuleTokenStream(adaptor,"token 33"); + RewriteRuleTokenStream stream_35=new RewriteRuleTokenStream(adaptor,"token 35"); + RewriteRuleTokenStream stream_29=new RewriteRuleTokenStream(adaptor,"token 29"); + RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat"); + + try { + // 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_literal20=(Token)match(input,33,FOLLOW_33_in_statlist620); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_33.add(string_literal20); + + // 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==33||(LA3_0 >= 37 && LA3_0 <= 38)||LA3_0==45) ) { + 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_statlist623); + stat21=stat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_stat.add(stat21.getTree()); + char_literal22=(Token)match(input,29,FOLLOW_29_in_statlist625); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_29.add(char_literal22); + + } + break; + + default : + break loop3; + } + } + + string_literal23=(Token)match(input,35,FOLLOW_35_in_statlist629); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_35.add(string_literal23); + + // 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 : ( assignstat | condstat | whilestat | forstat | statlist ); + public final XParser.stat_return stat() throws RecognitionException { + XParser.stat_return retval = new XParser.stat_return(); + retval.start = input.LT(1); + + CommonTree root_0 = null; + + ParserRuleReturnScope assignstat24 =null; + ParserRuleReturnScope condstat25 =null; + ParserRuleReturnScope whilestat26 =null; + ParserRuleReturnScope forstat27 =null; + ParserRuleReturnScope statlist28 =null; + + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:5: ( assignstat | condstat | whilestat | forstat | statlist ) + int alt4=5; + switch ( input.LA(1) ) { + case ID: + { + alt4=1; + } + break; + case 38: + { + alt4=2; + } + break; + case 45: + { + alt4=3; + } + break; + case 37: + { + alt4=4; + } + break; + case 33: + { + 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: assignstat + { + root_0 = (CommonTree)adaptor.nil(); + + + pushFollow(FOLLOW_assignstat_in_stat654); + assignstat24=assignstat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, assignstat24.getTree()); + + } + break; + case 2 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:30: condstat + { + root_0 = (CommonTree)adaptor.nil(); + + + pushFollow(FOLLOW_condstat_in_stat658); + condstat25=condstat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, condstat25.getTree()); + + } + break; + case 3 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:41: whilestat + { + root_0 = (CommonTree)adaptor.nil(); + + + pushFollow(FOLLOW_whilestat_in_stat662); + whilestat26=whilestat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, whilestat26.getTree()); + + } + break; + case 4 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:53: forstat + { + root_0 = (CommonTree)adaptor.nil(); + + + pushFollow(FOLLOW_forstat_in_stat666); + forstat27=forstat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, forstat27.getTree()); + + } + break; + case 5 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:63: statlist + { + root_0 = (CommonTree)adaptor.nil(); + + + pushFollow(FOLLOW_statlist_in_stat670); + statlist28=statlist(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, statlist28.getTree()); + + } + 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:74: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 ID29=null; + Token string_literal30=null; + ParserRuleReturnScope expr31 =null; + + CommonTree ID29_tree=null; + CommonTree string_literal30_tree=null; + RewriteRuleTokenStream stream_28=new RewriteRuleTokenStream(adaptor,"token 28"); + 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:74:11: ( ID ':=' expr -> ^( ':=' ID expr ) ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:74:17: ID ':=' expr + { + ID29=(Token)match(input,ID,FOLLOW_ID_in_assignstat680); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_ID.add(ID29); + + string_literal30=(Token)match(input,28,FOLLOW_28_in_assignstat682); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_28.add(string_literal30); + + pushFollow(FOLLOW_expr_in_assignstat684); + expr31=expr(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr.add(expr31.getTree()); + // AST REWRITE + // elements: 28, expr, 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(); + // 74:30: -> ^( ':=' ID expr ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:74:33: ^( ':=' ID expr ) + { + CommonTree root_1 = (CommonTree)adaptor.nil(); + root_1 = (CommonTree)adaptor.becomeRoot(stream_28.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:75: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_literal32=null; + Token string_literal34=null; + ParserRuleReturnScope cond33 =null; + ParserRuleReturnScope stat35 =null; + ParserRuleReturnScope condElseStat36 =null; + + CommonTree string_literal32_tree=null; + CommonTree string_literal34_tree=null; + RewriteRuleTokenStream stream_44=new RewriteRuleTokenStream(adaptor,"token 44"); + RewriteRuleTokenStream stream_38=new RewriteRuleTokenStream(adaptor,"token 38"); + 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:75: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:75:17: 'if' cond 'then' stat ( condElseStat )? + { + string_literal32=(Token)match(input,38,FOLLOW_38_in_condstat706); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_38.add(string_literal32); + + pushFollow(FOLLOW_cond_in_condstat708); + cond33=cond(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_cond.add(cond33.getTree()); + string_literal34=(Token)match(input,44,FOLLOW_44_in_condstat710); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_44.add(string_literal34); + + pushFollow(FOLLOW_stat_in_condstat712); + stat35=stat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_stat.add(stat35.getTree()); + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:75:39: ( condElseStat )? + int alt5=2; + int LA5_0 = input.LA(1); + if ( (LA5_0==34) ) { + int LA5_1 = input.LA(2); + if ( (synpred11_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:75:39: condElseStat + { + pushFollow(FOLLOW_condElseStat_in_condstat714); + condElseStat36=condElseStat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_condElseStat.add(condElseStat36.getTree()); + } + break; + + } + + // AST REWRITE + // elements: stat, 38, cond, 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(); + // 75:53: -> ^( 'if' cond stat ( condElseStat )? ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:75:56: ^( 'if' cond stat ( condElseStat )? ) + { + CommonTree root_1 = (CommonTree)adaptor.nil(); + root_1 = (CommonTree)adaptor.becomeRoot(stream_38.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:75: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:76: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_literal37=null; + ParserRuleReturnScope stat38 =null; + + CommonTree string_literal37_tree=null; + RewriteRuleTokenStream stream_34=new RewriteRuleTokenStream(adaptor,"token 34"); + 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:76:13: ( 'else' stat -> ^( 'else' stat ) ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:76:17: 'else' stat + { + string_literal37=(Token)match(input,34,FOLLOW_34_in_condElseStat737); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_34.add(string_literal37); + + pushFollow(FOLLOW_stat_in_condElseStat739); + stat38=stat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_stat.add(stat38.getTree()); + // AST REWRITE + // elements: 34, 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(); + // 76:29: -> ^( 'else' stat ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:76:32: ^( 'else' stat ) + { + CommonTree root_1 = (CommonTree)adaptor.nil(); + root_1 = (CommonTree)adaptor.becomeRoot(stream_34.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:77: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_literal39=null; + Token char_literal40=null; + Token char_literal42=null; + ParserRuleReturnScope cond41 =null; + ParserRuleReturnScope stat43 =null; + + CommonTree string_literal39_tree=null; + CommonTree char_literal40_tree=null; + CommonTree char_literal42_tree=null; + RewriteRuleTokenStream stream_45=new RewriteRuleTokenStream(adaptor,"token 45"); + RewriteRuleTokenStream stream_20=new RewriteRuleTokenStream(adaptor,"token 20"); + RewriteRuleTokenStream stream_21=new RewriteRuleTokenStream(adaptor,"token 21"); + RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat"); + RewriteRuleSubtreeStream stream_cond=new RewriteRuleSubtreeStream(adaptor,"rule cond"); + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77: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:77:17: 'while' '(' cond ')' stat + { + string_literal39=(Token)match(input,45,FOLLOW_45_in_whilestat758); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_45.add(string_literal39); + + char_literal40=(Token)match(input,20,FOLLOW_20_in_whilestat760); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_20.add(char_literal40); + + pushFollow(FOLLOW_cond_in_whilestat762); + cond41=cond(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_cond.add(cond41.getTree()); + char_literal42=(Token)match(input,21,FOLLOW_21_in_whilestat764); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_21.add(char_literal42); + + pushFollow(FOLLOW_stat_in_whilestat766); + stat43=stat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_stat.add(stat43.getTree()); + // AST REWRITE + // elements: stat, 45, cond + // 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:43: -> ^( 'while' cond stat ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:77:46: ^( 'while' cond stat ) + { + CommonTree root_1 = (CommonTree)adaptor.nil(); + root_1 = (CommonTree)adaptor.becomeRoot(stream_45.nextNode(), root_1); + adaptor.addChild(root_1, stream_cond.nextTree()); + adaptor.addChild(root_1, stream_stat.nextTree()); + adaptor.addChild(root_0, root_1); + } + + } + + + retval.tree = root_0; + } + + } + + retval.stop = input.LT(-1); + + 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:78: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_literal44=null; + Token char_literal45=null; + Token char_literal47=null; + Token char_literal49=null; + Token char_literal51=null; + ParserRuleReturnScope assignstat46 =null; + ParserRuleReturnScope cond48 =null; + ParserRuleReturnScope assignstat50 =null; + ParserRuleReturnScope stat52 =null; + + CommonTree string_literal44_tree=null; + CommonTree char_literal45_tree=null; + CommonTree char_literal47_tree=null; + CommonTree char_literal49_tree=null; + CommonTree char_literal51_tree=null; + RewriteRuleTokenStream stream_37=new RewriteRuleTokenStream(adaptor,"token 37"); + RewriteRuleTokenStream stream_29=new RewriteRuleTokenStream(adaptor,"token 29"); + RewriteRuleTokenStream stream_20=new RewriteRuleTokenStream(adaptor,"token 20"); + RewriteRuleTokenStream stream_21=new RewriteRuleTokenStream(adaptor,"token 21"); + RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat"); + RewriteRuleSubtreeStream stream_cond=new RewriteRuleSubtreeStream(adaptor,"rule cond"); + 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:78: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:78:17: 'for' '(' assignstat ';' cond ';' assignstat ')' stat + { + string_literal44=(Token)match(input,37,FOLLOW_37_in_forstat789); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_37.add(string_literal44); + + char_literal45=(Token)match(input,20,FOLLOW_20_in_forstat791); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_20.add(char_literal45); + + pushFollow(FOLLOW_assignstat_in_forstat793); + assignstat46=assignstat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_assignstat.add(assignstat46.getTree()); + char_literal47=(Token)match(input,29,FOLLOW_29_in_forstat795); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_29.add(char_literal47); + + pushFollow(FOLLOW_cond_in_forstat797); + cond48=cond(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_cond.add(cond48.getTree()); + char_literal49=(Token)match(input,29,FOLLOW_29_in_forstat799); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_29.add(char_literal49); + + pushFollow(FOLLOW_assignstat_in_forstat801); + assignstat50=assignstat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_assignstat.add(assignstat50.getTree()); + char_literal51=(Token)match(input,21,FOLLOW_21_in_forstat803); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_21.add(char_literal51); + + pushFollow(FOLLOW_stat_in_forstat805); + stat52=stat(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_stat.add(stat52.getTree()); + // AST REWRITE + // elements: assignstat, 37, stat, assignstat, cond + // 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:17: -> ^( 'for' assignstat cond assignstat stat ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:79:20: ^( 'for' assignstat cond assignstat stat ) + { + CommonTree root_1 = (CommonTree)adaptor.nil(); + root_1 = (CommonTree)adaptor.becomeRoot(stream_37.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:81:1: expr : ( expr2 '+' expr -> ^( '+' expr2 expr ) | expr2 '-' expr -> ^( '-' 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 char_literal54=null; + Token char_literal57=null; + ParserRuleReturnScope expr253 =null; + ParserRuleReturnScope expr55 =null; + ParserRuleReturnScope expr256 =null; + ParserRuleReturnScope expr58 =null; + ParserRuleReturnScope expr259 =null; + + CommonTree char_literal54_tree=null; + CommonTree char_literal57_tree=null; + RewriteRuleTokenStream stream_23=new RewriteRuleTokenStream(adaptor,"token 23"); + RewriteRuleTokenStream stream_24=new RewriteRuleTokenStream(adaptor,"token 24"); + 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:81:5: ( expr2 '+' expr -> ^( '+' expr2 expr ) | expr2 '-' expr -> ^( '-' expr2 expr ) | expr2 -> ^( expr2 ) ) + int alt6=3; + switch ( input.LA(1) ) { + case FLOATCONST: + case INTCONST: + { + int LA6_1 = input.LA(2); + if ( (synpred12_X()) ) { + alt6=1; + } + else if ( (synpred13_X()) ) { + alt6=2; + } + else if ( (true) ) { + alt6=3; + } + + } + break; + case 24: + { + int LA6_2 = input.LA(2); + if ( (synpred12_X()) ) { + alt6=1; + } + else if ( (synpred13_X()) ) { + alt6=2; + } + else if ( (true) ) { + alt6=3; + } + + } + break; + case STRINGCONST: + { + int LA6_3 = input.LA(2); + if ( (synpred12_X()) ) { + alt6=1; + } + else if ( (synpred13_X()) ) { + alt6=2; + } + else if ( (true) ) { + alt6=3; + } + + } + break; + case 20: + { + int LA6_4 = input.LA(2); + if ( (synpred12_X()) ) { + alt6=1; + } + else if ( (synpred13_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:81:13: expr2 '+' expr + { + pushFollow(FOLLOW_expr2_in_expr848); + expr253=expr2(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr2.add(expr253.getTree()); + char_literal54=(Token)match(input,23,FOLLOW_23_in_expr850); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_23.add(char_literal54); + + pushFollow(FOLLOW_expr_in_expr852); + expr55=expr(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr.add(expr55.getTree()); + // AST REWRITE + // elements: expr, 23, 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(); + // 81:35: -> ^( '+' expr2 expr ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:81:38: ^( '+' expr2 expr ) + { + CommonTree root_1 = (CommonTree)adaptor.nil(); + root_1 = (CommonTree)adaptor.becomeRoot(stream_23.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:82:15: expr2 '-' expr + { + pushFollow(FOLLOW_expr2_in_expr885); + expr256=expr2(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr2.add(expr256.getTree()); + char_literal57=(Token)match(input,24,FOLLOW_24_in_expr887); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_24.add(char_literal57); + + pushFollow(FOLLOW_expr_in_expr889); + expr58=expr(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr.add(expr58.getTree()); + // AST REWRITE + // elements: 24, 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(); + // 82:34: -> ^( '-' expr2 expr ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:37: ^( '-' expr2 expr ) + { + CommonTree root_1 = (CommonTree)adaptor.nil(); + root_1 = (CommonTree)adaptor.becomeRoot(stream_24.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:83:15: expr2 + { + pushFollow(FOLLOW_expr2_in_expr919); + expr259=expr2(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr2.add(expr259.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(); + // 83:37: -> ^( expr2 ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:83: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:84:1: expr2 : ( expr3 '*' expr2 -> ^( '*' expr3 expr2 ) | expr3 '/' expr2 -> ^( '/' 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 char_literal61=null; + Token char_literal64=null; + ParserRuleReturnScope expr360 =null; + ParserRuleReturnScope expr262 =null; + ParserRuleReturnScope expr363 =null; + ParserRuleReturnScope expr265 =null; + ParserRuleReturnScope expr366 =null; + + CommonTree char_literal61_tree=null; + CommonTree char_literal64_tree=null; + RewriteRuleTokenStream stream_22=new RewriteRuleTokenStream(adaptor,"token 22"); + RewriteRuleTokenStream stream_26=new RewriteRuleTokenStream(adaptor,"token 26"); + 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:84:6: ( expr3 '*' expr2 -> ^( '*' expr3 expr2 ) | expr3 '/' expr2 -> ^( '/' expr3 expr2 ) | expr3 -> ^( expr3 ) ) + int alt7=3; + switch ( input.LA(1) ) { + case FLOATCONST: + case INTCONST: + { + int LA7_1 = input.LA(2); + if ( (synpred14_X()) ) { + alt7=1; + } + else if ( (synpred15_X()) ) { + alt7=2; + } + else if ( (true) ) { + alt7=3; + } + + } + break; + case 24: + { + int LA7_2 = input.LA(2); + if ( (synpred14_X()) ) { + alt7=1; + } + else if ( (synpred15_X()) ) { + alt7=2; + } + else if ( (true) ) { + alt7=3; + } + + } + break; + case STRINGCONST: + { + int LA7_3 = input.LA(2); + if ( (synpred14_X()) ) { + alt7=1; + } + else if ( (synpred15_X()) ) { + alt7=2; + } + else if ( (true) ) { + alt7=3; + } + + } + break; + case 20: + { + int LA7_4 = input.LA(2); + if ( (synpred14_X()) ) { + alt7=1; + } + else if ( (synpred15_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:84:13: expr3 '*' expr2 + { + pushFollow(FOLLOW_expr3_in_expr2952); + expr360=expr3(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr3.add(expr360.getTree()); + char_literal61=(Token)match(input,22,FOLLOW_22_in_expr2954); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_22.add(char_literal61); + + pushFollow(FOLLOW_expr2_in_expr2956); + expr262=expr2(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr2.add(expr262.getTree()); + // AST REWRITE + // elements: 22, expr2, 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(); + // 84:31: -> ^( '*' expr3 expr2 ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:34: ^( '*' expr3 expr2 ) + { + CommonTree root_1 = (CommonTree)adaptor.nil(); + root_1 = (CommonTree)adaptor.becomeRoot(stream_22.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:85:15: expr3 '/' expr2 + { + pushFollow(FOLLOW_expr3_in_expr2984); + expr363=expr3(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr3.add(expr363.getTree()); + char_literal64=(Token)match(input,26,FOLLOW_26_in_expr2986); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_26.add(char_literal64); + + pushFollow(FOLLOW_expr2_in_expr2988); + expr265=expr2(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr2.add(expr265.getTree()); + // AST REWRITE + // elements: expr3, expr2, 26 + // 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:33: -> ^( '/' expr3 expr2 ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:85:36: ^( '/' expr3 expr2 ) + { + CommonTree root_1 = (CommonTree)adaptor.nil(); + root_1 = (CommonTree)adaptor.becomeRoot(stream_26.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:86:15: expr3 + { + pushFollow(FOLLOW_expr3_in_expr21016); + expr366=expr3(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_expr3.add(expr366.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(); + // 86:37: -> ^( expr3 ) + { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86: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:87:1: expr3 : ( number | '-' number | STRINGCONST | '(' ! 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 char_literal68=null; + Token STRINGCONST70=null; + Token char_literal71=null; + Token char_literal73=null; + ParserRuleReturnScope number67 =null; + ParserRuleReturnScope number69 =null; + ParserRuleReturnScope expr72 =null; + + CommonTree char_literal68_tree=null; + CommonTree STRINGCONST70_tree=null; + CommonTree char_literal71_tree=null; + CommonTree char_literal73_tree=null; + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:6: ( number | '-' number | STRINGCONST | '(' ! expr ^ ')' ) + int alt8=4; + switch ( input.LA(1) ) { + case FLOATCONST: + case INTCONST: + { + alt8=1; + } + break; + case 24: + { + alt8=2; + } + break; + case STRINGCONST: + { + alt8=3; + } + break; + case 20: + { + alt8=4; + } + 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:87:13: number + { + root_0 = (CommonTree)adaptor.nil(); + + + pushFollow(FOLLOW_number_in_expr31049); + number67=number(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, number67.getTree()); + + } + break; + case 2 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:22: '-' number + { + root_0 = (CommonTree)adaptor.nil(); + + + char_literal68=(Token)match(input,24,FOLLOW_24_in_expr31053); if (state.failed) return retval; + if ( state.backtracking==0 ) { + char_literal68_tree = (CommonTree)adaptor.create(char_literal68); + adaptor.addChild(root_0, char_literal68_tree); + } + + pushFollow(FOLLOW_number_in_expr31055); + number69=number(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, number69.getTree()); + + } + break; + case 3 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:35: STRINGCONST + { + root_0 = (CommonTree)adaptor.nil(); + + + STRINGCONST70=(Token)match(input,STRINGCONST,FOLLOW_STRINGCONST_in_expr31059); if (state.failed) return retval; + if ( state.backtracking==0 ) { + STRINGCONST70_tree = (CommonTree)adaptor.create(STRINGCONST70); + adaptor.addChild(root_0, STRINGCONST70_tree); + } + + } + break; + case 4 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:49: '(' ! expr ^ ')' + { + root_0 = (CommonTree)adaptor.nil(); + + + char_literal71=(Token)match(input,20,FOLLOW_20_in_expr31063); if (state.failed) return retval; + pushFollow(FOLLOW_expr_in_expr31066); + expr72=expr(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) root_0 = (CommonTree)adaptor.becomeRoot(expr72.getTree(), root_0); + char_literal73=(Token)match(input,21,FOLLOW_21_in_expr31069); if (state.failed) return retval; + if ( state.backtracking==0 ) { + char_literal73_tree = (CommonTree)adaptor.create(char_literal73); + adaptor.addChild(root_0, char_literal73_tree); + } + + } + 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:88: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 set74=null; + + CommonTree set74_tree=null; + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:88: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(); + + + set74=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(set74)); + 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 compOp_return extends ParserRuleReturnScope { + CommonTree tree; + @Override + public CommonTree getTree() { return tree; } + }; + + + // $ANTLR start "compOp" + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:90:1: compOp : ( '<' | '>' | '=' ); + public final XParser.compOp_return compOp() throws RecognitionException { + XParser.compOp_return retval = new XParser.compOp_return(); + retval.start = input.LT(1); + + CommonTree root_0 = null; + + Token set75=null; + + CommonTree set75_tree=null; + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:90:7: ( '<' | '>' | '=' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g: + { + root_0 = (CommonTree)adaptor.nil(); + + + set75=input.LT(1); + if ( (input.LA(1) >= 30 && input.LA(1) <= 32) ) { + input.consume(); + if ( state.backtracking==0 ) adaptor.addChild(root_0, (CommonTree)adaptor.create(set75)); + 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 "compOp" + + + 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:91:1: cond : 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 expr76 =null; + ParserRuleReturnScope cond277 =null; + + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:91:5: ( expr cond2 ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:91:13: expr cond2 + { + root_0 = (CommonTree)adaptor.nil(); + + + pushFollow(FOLLOW_expr_in_cond1114); + expr76=expr(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, expr76.getTree()); + + pushFollow(FOLLOW_cond2_in_cond1116); + cond277=cond2(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, cond277.getTree()); + + } + + 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:92:1: cond2 : compOp 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; + + ParserRuleReturnScope compOp78 =null; + ParserRuleReturnScope expr79 =null; + + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:92:6: ( compOp expr ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:92:13: compOp expr + { + root_0 = (CommonTree)adaptor.nil(); + + + pushFollow(FOLLOW_compOp_in_cond21127); + compOp78=compOp(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, compOp78.getTree()); + + pushFollow(FOLLOW_expr_in_cond21129); + expr79=expr(); + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, expr79.getTree()); + + } + + 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" + + + public static class minus_return extends ParserRuleReturnScope { + CommonTree tree; + @Override + public CommonTree getTree() { return tree; } + }; + + + // $ANTLR start "minus" + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:97:1: minus : '-' ; + public final XParser.minus_return minus() throws RecognitionException { + XParser.minus_return retval = new XParser.minus_return(); + retval.start = input.LT(1); + + CommonTree root_0 = null; + + Token char_literal80=null; + + CommonTree char_literal80_tree=null; + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:97:6: ( '-' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:97:13: '-' + { + root_0 = (CommonTree)adaptor.nil(); + + + char_literal80=(Token)match(input,24,FOLLOW_24_in_minus1144); if (state.failed) return retval; + if ( state.backtracking==0 ) { + char_literal80_tree = (CommonTree)adaptor.create(char_literal80); + adaptor.addChild(root_0, char_literal80_tree); + } + + } + + 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 "minus" + + + public static class div_return extends ParserRuleReturnScope { + CommonTree tree; + @Override + public CommonTree getTree() { return tree; } + }; + + + // $ANTLR start "div" + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:98:1: div : '/' ; + public final XParser.div_return div() throws RecognitionException { + XParser.div_return retval = new XParser.div_return(); + retval.start = input.LT(1); + + CommonTree root_0 = null; + + Token char_literal81=null; + + CommonTree char_literal81_tree=null; + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:98:4: ( '/' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:98:11: '/' + { + root_0 = (CommonTree)adaptor.nil(); + + + char_literal81=(Token)match(input,26,FOLLOW_26_in_div1155); if (state.failed) return retval; + if ( state.backtracking==0 ) { + char_literal81_tree = (CommonTree)adaptor.create(char_literal81); + adaptor.addChild(root_0, char_literal81_tree); + } + + } + + 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 "div" + + + public static class multiply_return extends ParserRuleReturnScope { + CommonTree tree; + @Override + public CommonTree getTree() { return tree; } + }; + + + // $ANTLR start "multiply" + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:99:1: multiply : '*' ; + public final XParser.multiply_return multiply() throws RecognitionException { + XParser.multiply_return retval = new XParser.multiply_return(); + retval.start = input.LT(1); + + CommonTree root_0 = null; + + Token char_literal82=null; + + CommonTree char_literal82_tree=null; + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:99:9: ( '*' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:99:16: '*' + { + root_0 = (CommonTree)adaptor.nil(); + + + char_literal82=(Token)match(input,22,FOLLOW_22_in_multiply1166); if (state.failed) return retval; + if ( state.backtracking==0 ) { + char_literal82_tree = (CommonTree)adaptor.create(char_literal82); + adaptor.addChild(root_0, char_literal82_tree); + } + + } + + 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 "multiply" + + + public static class plus_return extends ParserRuleReturnScope { + CommonTree tree; + @Override + public CommonTree getTree() { return tree; } + }; + + + // $ANTLR start "plus" + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:100:1: plus : '+' ; + public final XParser.plus_return plus() throws RecognitionException { + XParser.plus_return retval = new XParser.plus_return(); + retval.start = input.LT(1); + + CommonTree root_0 = null; + + Token char_literal83=null; + + CommonTree char_literal83_tree=null; + + try { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:100:5: ( '+' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:100:13: '+' + { + root_0 = (CommonTree)adaptor.nil(); + + + char_literal83=(Token)match(input,23,FOLLOW_23_in_plus1178); if (state.failed) return retval; + if ( state.backtracking==0 ) { + char_literal83_tree = (CommonTree)adaptor.create(char_literal83); + adaptor.addChild(root_0, char_literal83_tree); + } + + } + + 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 "plus" + + // $ANTLR start synpred2_X + public final void synpred2_X_fragment() throws RecognitionException { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:17: ( 'read' ( 'print' )? ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:17: 'read' ( 'print' )? + { + match(input,42,FOLLOW_42_in_synpred2_X571); if (state.failed) return; + + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:24: ( 'print' )? + int alt9=2; + int LA9_0 = input.LA(1); + if ( (LA9_0==40) ) { + alt9=1; + } + switch (alt9) { + case 1 : + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:24: 'print' + { + match(input,40,FOLLOW_40_in_synpred2_X573); if (state.failed) return; + + } + break; + + } + + } + + } + // $ANTLR end synpred2_X + + // $ANTLR start synpred3_X + public final void synpred3_X_fragment() throws RecognitionException { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:35: ( 'read' ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68:35: 'read' + { + match(input,42,FOLLOW_42_in_synpred3_X578); if (state.failed) return; + + } + + } + // $ANTLR end synpred3_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:75:39: ( condElseStat ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:75:39: condElseStat + { + pushFollow(FOLLOW_condElseStat_in_synpred11_X714); + condElseStat(); + 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:81:13: ( expr2 '+' expr ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:81:13: expr2 '+' expr + { + pushFollow(FOLLOW_expr2_in_synpred12_X848); + expr2(); + state._fsp--; + if (state.failed) return; + + match(input,23,FOLLOW_23_in_synpred12_X850); if (state.failed) return; + + pushFollow(FOLLOW_expr_in_synpred12_X852); + 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:82:15: ( expr2 '-' expr ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:15: expr2 '-' expr + { + pushFollow(FOLLOW_expr2_in_synpred13_X885); + expr2(); + state._fsp--; + if (state.failed) return; + + match(input,24,FOLLOW_24_in_synpred13_X887); if (state.failed) return; + + pushFollow(FOLLOW_expr_in_synpred13_X889); + expr(); + 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:84:13: ( expr3 '*' expr2 ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:13: expr3 '*' expr2 + { + pushFollow(FOLLOW_expr3_in_synpred14_X952); + expr3(); + state._fsp--; + if (state.failed) return; + + match(input,22,FOLLOW_22_in_synpred14_X954); if (state.failed) return; + + pushFollow(FOLLOW_expr2_in_synpred14_X956); + expr2(); + state._fsp--; + if (state.failed) return; + + } + + } + // $ANTLR end synpred14_X + + // $ANTLR start synpred15_X + public final void synpred15_X_fragment() throws RecognitionException { + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:85:15: ( expr3 '/' expr2 ) + // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:85:15: expr3 '/' expr2 + { + pushFollow(FOLLOW_expr3_in_synpred15_X984); + expr3(); + state._fsp--; + if (state.failed) return; + + match(input,26,FOLLOW_26_in_synpred15_X986); if (state.failed) return; + + pushFollow(FOLLOW_expr2_in_synpred15_X988); + expr2(); + state._fsp--; + if (state.failed) return; + + } + + } + // $ANTLR end synpred15_X + // Delegated rules + public final boolean synpred15_X() { + state.backtracking++; + int start = input.mark(); + try { + synpred15_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 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 synpred3_X() { + state.backtracking++; + int start = input.mark(); + try { + synpred3_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 synpred2_X() { + state.backtracking++; + int start = input.mark(); + try { + synpred2_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 static final BitSet FOLLOW_8_in_program272 = new BitSet(new long[]{0x0000000000000002L}); + + public static final BitSet FOLLOW_41_in_program473 = new BitSet(new long[]{0x0000000000000400L}); + public static final BitSet FOLLOW_ID_in_program475 = new BitSet(new long[]{0x0000000020000000L}); + public static final BitSet FOLLOW_29_in_program477 = new BitSet(new long[]{0x0000050000000000L}); + public static final BitSet FOLLOW_decllist_in_program479 = new BitSet(new long[]{0x0000000200000000L}); + public static final BitSet FOLLOW_statlist_in_program481 = new BitSet(new long[]{0x0000000002000000L}); + public static final BitSet FOLLOW_25_in_program483 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_program485 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_decl_in_decllist511 = new BitSet(new long[]{0x0000050000000000L}); + public static final BitSet FOLLOW_decllist_in_decllist513 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_modifier_in_decl539 = new BitSet(new long[]{0x0000000000000400L}); + public static final BitSet FOLLOW_ID_in_decl541 = new BitSet(new long[]{0x0000000008000000L}); + public static final BitSet FOLLOW_27_in_decl543 = new BitSet(new long[]{0x0000089000000000L}); + public static final BitSet FOLLOW_type_in_decl545 = new BitSet(new long[]{0x0000000020000000L}); + public static final BitSet FOLLOW_29_in_decl547 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_42_in_modifier571 = new BitSet(new long[]{0x0000010000000002L}); + public static final BitSet FOLLOW_40_in_modifier573 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_42_in_modifier578 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_40_in_modifier582 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_33_in_statlist620 = new BitSet(new long[]{0x0000206A00000400L}); + public static final BitSet FOLLOW_stat_in_statlist623 = new BitSet(new long[]{0x0000000020000000L}); + public static final BitSet FOLLOW_29_in_statlist625 = new BitSet(new long[]{0x0000206A00000400L}); + public static final BitSet FOLLOW_35_in_statlist629 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_assignstat_in_stat654 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_condstat_in_stat658 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_whilestat_in_stat662 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_forstat_in_stat666 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_statlist_in_stat670 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ID_in_assignstat680 = new BitSet(new long[]{0x0000000010000000L}); + public static final BitSet FOLLOW_28_in_assignstat682 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr_in_assignstat684 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_38_in_condstat706 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_cond_in_condstat708 = new BitSet(new long[]{0x0000100000000000L}); + public static final BitSet FOLLOW_44_in_condstat710 = new BitSet(new long[]{0x0000206200000400L}); + public static final BitSet FOLLOW_stat_in_condstat712 = new BitSet(new long[]{0x0000000400000002L}); + public static final BitSet FOLLOW_condElseStat_in_condstat714 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_34_in_condElseStat737 = new BitSet(new long[]{0x0000206200000400L}); + public static final BitSet FOLLOW_stat_in_condElseStat739 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_45_in_whilestat758 = new BitSet(new long[]{0x0000000000100000L}); + public static final BitSet FOLLOW_20_in_whilestat760 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_cond_in_whilestat762 = new BitSet(new long[]{0x0000000000200000L}); + public static final BitSet FOLLOW_21_in_whilestat764 = new BitSet(new long[]{0x0000206200000400L}); + public static final BitSet FOLLOW_stat_in_whilestat766 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_37_in_forstat789 = new BitSet(new long[]{0x0000000000100000L}); + public static final BitSet FOLLOW_20_in_forstat791 = new BitSet(new long[]{0x0000000000000400L}); + public static final BitSet FOLLOW_assignstat_in_forstat793 = new BitSet(new long[]{0x0000000020000000L}); + public static final BitSet FOLLOW_29_in_forstat795 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_cond_in_forstat797 = new BitSet(new long[]{0x0000000020000000L}); + public static final BitSet FOLLOW_29_in_forstat799 = new BitSet(new long[]{0x0000000000000400L}); + public static final BitSet FOLLOW_assignstat_in_forstat801 = new BitSet(new long[]{0x0000000000200000L}); + public static final BitSet FOLLOW_21_in_forstat803 = new BitSet(new long[]{0x0000206200000400L}); + public static final BitSet FOLLOW_stat_in_forstat805 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr2_in_expr848 = new BitSet(new long[]{0x0000000000800000L}); + public static final BitSet FOLLOW_23_in_expr850 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr_in_expr852 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr2_in_expr885 = new BitSet(new long[]{0x0000000001000000L}); + public static final BitSet FOLLOW_24_in_expr887 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr_in_expr889 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr2_in_expr919 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr3_in_expr2952 = new BitSet(new long[]{0x0000000000400000L}); + public static final BitSet FOLLOW_22_in_expr2954 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr2_in_expr2956 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr3_in_expr2984 = new BitSet(new long[]{0x0000000004000000L}); + public static final BitSet FOLLOW_26_in_expr2986 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr2_in_expr2988 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr3_in_expr21016 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_number_in_expr31049 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_24_in_expr31053 = new BitSet(new long[]{0x0000000000000A00L}); + public static final BitSet FOLLOW_number_in_expr31055 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_STRINGCONST_in_expr31059 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_20_in_expr31063 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr_in_expr31066 = new BitSet(new long[]{0x0000000000200000L}); + public static final BitSet FOLLOW_21_in_expr31069 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr_in_cond1114 = new BitSet(new long[]{0x00000001C0000000L}); + public static final BitSet FOLLOW_cond2_in_cond1116 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_compOp_in_cond21127 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr_in_cond21129 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_24_in_minus1144 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_26_in_div1155 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_22_in_multiply1166 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_23_in_plus1178 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_42_in_synpred2_X571 = new BitSet(new long[]{0x0000010000000002L}); + public static final BitSet FOLLOW_40_in_synpred2_X573 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_42_in_synpred3_X578 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_condElseStat_in_synpred11_X714 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr2_in_synpred12_X848 = new BitSet(new long[]{0x0000000000800000L}); + public static final BitSet FOLLOW_23_in_synpred12_X850 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr_in_synpred12_X852 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr2_in_synpred13_X885 = new BitSet(new long[]{0x0000000001000000L}); + public static final BitSet FOLLOW_24_in_synpred13_X887 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr_in_synpred13_X889 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr3_in_synpred14_X952 = new BitSet(new long[]{0x0000000000400000L}); + public static final BitSet FOLLOW_22_in_synpred14_X954 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr2_in_synpred14_X956 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_expr3_in_synpred15_X984 = new BitSet(new long[]{0x0000000004000000L}); + public static final BitSet FOLLOW_26_in_synpred15_X986 = new BitSet(new long[]{0x0000000001120A00L}); + public static final BitSet FOLLOW_expr2_in_synpred15_X988 = new BitSet(new long[]{0x0000000000000002L}); } 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 7711ce3..d6cb0b7 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 @@ -25,10 +25,6 @@ tokens { FLOATCONST; WS; MODIFIER; - UMINUS='-'; - UPLUS='+'; - UMULTIPLY='*'; - UDIVIDE='/'; DECLIST; PROGRAM; DECL; @@ -36,6 +32,7 @@ tokens { STAT; STATLIST; EXPR; + INVALID; } @parser::header {package de.dhbw.compiler.antlrxparser;} @@ -48,31 +45,32 @@ ID: ('a'..'z' | 'A'..'Z') 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' | ('1'..'9') ('0'..'9')*; +FLOATCONST: INTCONST ('.' DIGIT*)? ('e'|'E')('+' |'-' )? INTCONST + | INTCONST ('.' DIGIT*)?; STRINGCONST: '"' (ESCAPE | ~('\\' | '"'))* '"'; ESCAPE: '\\' ('\"' |'\'' | '\\'); -BINOP: '+' | '-' | '*' | '/' | '<' | '>' | '='; +WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); }; -WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); }; +INVALID: .; + +fragment DIGIT: ('0'..'9'); // -- Parser stuff -program: 'program' ID ';' decllist statlist '.' EOF -> ^(PROGRAM ID decllist statlist); +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]); +modifier: 'read' 'print'? | 'read' | 'print'; +type: 'int' | 'float' | 'string'; // Block statlist: 'begin' (stat ';')* 'end' -> ^(STATLIST stat*); -stat: t=assignstat | t=condstat | t=whilestat | t=forstat -> ^(STAT[t]) - | statlist - -> ^(STATLIST statlist); +stat: assignstat | condstat | whilestat | forstat | statlist; assignstat: ID ':=' expr -> ^(':=' ID expr); condstat: 'if' cond 'then' stat condElseStat? -> ^('if' cond stat condElseStat? ); condElseStat: 'else' stat -> ^('else' stat); @@ -80,18 +78,23 @@ 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) +expr: expr2 '+' expr -> ^('+' expr2 expr) + | expr2 '-' expr -> ^('-' expr2 expr) | expr2 -> ^(expr2); -expr2: expr3 UMULTIPLY expr2 -> ^(UMULTIPLY expr3 expr2) - | expr3 UDIVIDE expr2 -> ^(UDIVIDE expr3 expr2) +expr2: expr3 '*' expr2 -> ^('*' expr3 expr2) + | expr3 '/' expr2 -> ^('/' expr3 expr2) | expr3 -> ^(expr3); -expr3: number -> ^(number) - | UMINUS number -> ^(UMINUS number) - | t=STRINGCONST | t=ID -> ^($t) - | '(' expr ')' -> ^(expr); +expr3: number | '-' number | STRINGCONST | '('! expr^ ')'; number: INTCONST | FLOATCONST; -cond: expr cond2 -> ^(expr cond2); -cond2: BINOP expr -> ^(BINOP expr); +compOp: '<' | '>' | '='; +cond: expr cond2; +cond2: compOp expr; +// -- Dummy rules +// Das sollte dafür sorgen, dass implizite Tokens auch ihre Tokens bekommen +// TODO: Remove this +minus: '-'; +div: '/'; +multiply: '*'; +plus: '+'; diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/X.tokens b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/X.tokens new file mode 100644 index 0000000..f7075a8 --- /dev/null +++ b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/X.tokens @@ -0,0 +1,68 @@ +T__20=20 +T__21=21 +T__22=22 +T__23=23 +T__24=24 +T__25=25 +T__26=26 +T__27=27 +T__28=28 +T__29=29 +T__30=30 +T__31=31 +T__32=32 +T__33=33 +T__34=34 +T__35=35 +T__36=36 +T__37=37 +T__38=38 +T__39=39 +T__40=40 +T__41=41 +T__42=42 +T__43=43 +T__44=44 +T__45=45 +DECL=4 +DECLIST=5 +DIGIT=6 +ESCAPE=7 +EXPR=8 +FLOATCONST=9 +ID=10 +INTCONST=11 +INVALID=12 +MODIFIER=13 +PROGRAM=14 +STAT=15 +STATLIST=16 +STRINGCONST=17 +TYPE=18 +WS=19 +'('=20 +')'=21 +'*'=22 +'+'=23 +'-'=24 +'.'=25 +'/'=26 +':'=27 +':='=28 +';'=29 +'<'=30 +'='=31 +'>'=32 +'begin'=33 +'else'=34 +'end'=35 +'float'=36 +'for'=37 +'if'=38 +'int'=39 +'print'=40 +'program'=41 +'read'=42 +'string'=43 +'then'=44 +'while'=45 diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA12.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA12.class new file mode 100644 index 0000000..cb15dbf Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA12.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA4.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA4.class deleted file mode 100644 index b4f107b..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA4.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA9.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA9.class new file mode 100644 index 0000000..226d08d Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA9.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer.class index 05cc11e..24cf2b6 100644 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer.class and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$assignstat_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$assignstat_return.class new file mode 100644 index 0000000..c14b0e9 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$assignstat_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$compOp_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$compOp_return.class new file mode 100644 index 0000000..5b4e7dd Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$compOp_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$cond2_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$cond2_return.class new file mode 100644 index 0000000..203dadc Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$cond2_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$condElseStat_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$condElseStat_return.class new file mode 100644 index 0000000..c94606f Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$condElseStat_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$cond_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$cond_return.class new file mode 100644 index 0000000..3b00a06 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$cond_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$condstat_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$condstat_return.class new file mode 100644 index 0000000..01f4fcf Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$condstat_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$decl_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$decl_return.class new file mode 100644 index 0000000..0e627a8 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$decl_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$decllist_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$decllist_return.class new file mode 100644 index 0000000..4ff9fcb Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$decllist_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$div_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$div_return.class new file mode 100644 index 0000000..3bc8f93 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$div_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr2_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr2_return.class new file mode 100644 index 0000000..2567897 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr2_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr3_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr3_return.class new file mode 100644 index 0000000..a3da040 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr3_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr_return.class new file mode 100644 index 0000000..4240979 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$forstat_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$forstat_return.class new file mode 100644 index 0000000..2db82ca Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$forstat_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$minus_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$minus_return.class new file mode 100644 index 0000000..6cde354 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$minus_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$modifier_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$modifier_return.class new file mode 100644 index 0000000..ebacce9 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$modifier_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$multiply_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$multiply_return.class new file mode 100644 index 0000000..c873502 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$multiply_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$number_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$number_return.class new file mode 100644 index 0000000..ee6ef79 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$number_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$plus_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$plus_return.class new file mode 100644 index 0000000..3db831a Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$plus_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$program_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$program_return.class index e82c7e5..f1fff25 100644 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$program_return.class and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$program_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$stat_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$stat_return.class new file mode 100644 index 0000000..336315f Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$stat_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$statlist_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$statlist_return.class new file mode 100644 index 0000000..8ef0fb4 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$statlist_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$type_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$type_return.class new file mode 100644 index 0000000..f929342 Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$type_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$whilestat_return.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$whilestat_return.class new file mode 100644 index 0000000..7c794da Binary files /dev/null and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$whilestat_return.class differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser.class index 6aa6859..4ca04bf 100644 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser.class and b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser.class differ diff --git a/ÜB-Praxis-JFlex Scanner für AS-Leer/ÜB-Praxis-JFlex Scanner für AS-Leer.iml b/ÜB-Praxis-JFlex Scanner für AS-Leer/ÜB-Praxis-JFlex Scanner für AS-Leer.iml index 5e98636..c90834f 100644 --- a/ÜB-Praxis-JFlex Scanner für AS-Leer/ÜB-Praxis-JFlex Scanner für AS-Leer.iml +++ b/ÜB-Praxis-JFlex Scanner für AS-Leer/ÜB-Praxis-JFlex Scanner für AS-Leer.iml @@ -1,38 +1,11 @@ - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file