diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ed8b004..f913714 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,22 @@ +<<<<<<< Updated upstream +======= + + + + + + + + + + + + +>>>>>>> Stashed changes @@ -179,6 +207,7 @@ +<<<<<<< Updated upstream @@ -218,6 +247,44 @@ +======= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>>>>>>> Stashed changes diff --git a/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens b/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens new file mode 100644 index 0000000..607d1d6 --- /dev/null +++ b/CC-Praxis-Antlr Parser fuer X-Leer/X.tokens @@ -0,0 +1,68 @@ +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 +DECL=4 +DECLIST=5 +ESCAPE=6 +EXPR=7 +FLOATCONST=8 +ID=9 +INTCONST=10 +MODIFIER=11 +PROGRAM=12 +STAT=13 +STATLIST=14 +STRINGCONST=15 +TYPE=16 +UDIVIDE=17 +UMINUS=18 +UMULTIPLY=19 +UPLUS=20 +WS=21 +'('=22 +')'=23 +'*'=19 +'+'=20 +'-'=18 +'.'=24 +'/'=17 +':'=25 +':='=26 +';'=27 +'<'=28 +'='=29 +'>'=30 +'begin'=31 +'else'=32 +'end'=33 +'float'=34 +'for'=35 +'if'=36 +'int'=37 +'print'=38 +'program'=39 +'read print'=40 +'read'=41 +'string'=42 +'then'=43 +'while'=44 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 d892806..7c1c731 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 @@ -86,7 +86,6 @@ expr2: expr3 (op='*' | op='/') expr -> ^($op expr3 expr) expr3: op='-' num=number -> ^(UMINUS[op,"UMINUS"] $num) | number | STRINGCONST | '('! expr^ ')'!; -// Conditions and comparison compOp: '<' | '>' | '='; cond: expr cond2; cond2: compOp expr; 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 deleted file mode 100644 index cdace7e..0000000 --- a/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/XLexer.java +++ /dev/null @@ -1,1592 +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 14:37:29 -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__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 T__46=46; - public static final int DECL=4; - public static final int DECLLIST=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 UMINUS=19; - public static final int WS=20; - - // 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 "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:9:7: ( '(' ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:9: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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__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: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__45" - - // $ANTLR start "T__46" - public final void mT__46() throws RecognitionException { - try { - int _type = T__46; - 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__46" - - // $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:44: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:44: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:45: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:47: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:47: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:47: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:49: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; - } - - else { - NoViableAltException nvae = - new NoViableAltException("", 3, 0, input); - throw nvae; - } - - switch (alt3) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:17: '0' - { - match('0'); - } - break; - case 2 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:49:23: ( '1' .. '9' ) ( '0' .. '9' )* - { - if ( (input.LA(1) >= '1' && input.LA(1) <= '9') ) { - 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: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; - - } - 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:50: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:50:17: INTCONST ( '.' ( DIGIT )* )? ( 'e' | 'E' ) ( '+' | '-' )? INTCONST - { - mINTCONST(); - - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:50: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:50:27: '.' ( DIGIT )* - { - match('.'); - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:50: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:50: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:51:19: INTCONST ( '.' ( DIGIT )* )? - { - mINTCONST(); - - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:51: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:51:29: '.' ( DIGIT )* - { - match('.'); - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:51: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; - } - 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:53:12: ( '\"' ( ESCAPE |~ ( '\\\\' | '\"' ) )* '\"' ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:53:17: '\"' ( ESCAPE |~ ( '\\\\' | '\"' ) )* '\"' - { - match('\"'); - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:53: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:53:22: ESCAPE - { - mESCAPE(); - - } - break; - case 2 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:53: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:54:7: ( '\\\\' ( '\\\"' | '\\'' | '\\\\' ) ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:54: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; - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:56:3: ( ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:56:17: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:56:17: ( '\\t' | ' ' | '\\r' | '\\n' | '\\f' )+ - int cnt11=0; - loop11: - while (true) { - 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 (alt11) { - 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 ( cnt11 >= 1 ) break loop11; - EarlyExitException eee = new EarlyExitException(11, input); - throw eee; - } - cnt11++; - } - - skip(); - } - - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - // $ANTLR end "WS" - - // $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:58: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 { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:8: ( 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 | T__46 | ID | INTCONST | FLOATCONST | STRINGCONST | ESCAPE | WS ) - int alt12=32; - alt12 = dfa12.predict(input); - switch (alt12) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:10: T__21 - { - mT__21(); - - } - break; - case 2 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:16: T__22 - { - mT__22(); - - } - break; - case 3 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:22: T__23 - { - mT__23(); - - } - break; - case 4 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:28: T__24 - { - mT__24(); - - } - break; - case 5 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:34: T__25 - { - mT__25(); - - } - break; - case 6 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:40: T__26 - { - mT__26(); - - } - break; - case 7 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:46: T__27 - { - mT__27(); - - } - break; - case 8 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:52: T__28 - { - mT__28(); - - } - break; - case 9 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:58: T__29 - { - mT__29(); - - } - break; - case 10 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:64: T__30 - { - mT__30(); - - } - break; - case 11 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:70: T__31 - { - mT__31(); - - } - break; - case 12 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:76: T__32 - { - mT__32(); - - } - break; - case 13 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:82: T__33 - { - mT__33(); - - } - break; - case 14 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:88: T__34 - { - mT__34(); - - } - break; - case 15 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:94: T__35 - { - mT__35(); - - } - break; - case 16 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:100: T__36 - { - mT__36(); - - } - break; - case 17 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:106: T__37 - { - mT__37(); - - } - break; - case 18 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:112: T__38 - { - mT__38(); - - } - break; - case 19 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:118: T__39 - { - mT__39(); - - } - break; - case 20 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:124: T__40 - { - mT__40(); - - } - break; - case 21 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:130: T__41 - { - mT__41(); - - } - break; - case 22 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:136: T__42 - { - mT__42(); - - } - break; - case 23 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:142: T__43 - { - mT__43(); - - } - break; - case 24 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:148: T__44 - { - mT__44(); - - } - break; - case 25 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:154: T__45 - { - mT__45(); - - } - break; - case 26 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:1:160: T__46 - { - mT__46(); - - } - 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 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 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 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; - - } - } - - - 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", - "", - "\12\7\13\uffff\1\5\37\uffff\1\5", - "", - "\1\4\1\uffff\12\6\13\uffff\1\5\37\uffff\1\5", - "\12\7\13\uffff\1\5\37\uffff\1\5" - }; - - static final short[] 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 = DFA9_transitionS.length; - DFA9_transition = new short[numStates][]; - for (int i=0; i"; - static final String[] DFA12_transitionS = { - "\2\33\1\uffff\2\33\22\uffff\1\33\1\uffff\1\31\5\uffff\1\1\1\2\1\3\1\4"+ - "\1\uffff\1\5\1\6\1\7\1\27\11\30\1\10\1\11\1\12\1\13\1\14\2\uffff\32\26"+ - "\1\uffff\1\32\4\uffff\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", - "", - "", - "", - "", - "", - "", - "", - "\1\34", - "", - "", - "", - "", - "\1\36", - "\1\37\1\uffff\1\40", - "\1\41\2\uffff\1\42", - "\1\43\7\uffff\1\44", - "\1\45", - "\1\46", - "\1\47", - "\1\50", - "\1\51", - "", - "\1\53\26\uffff\1\53\37\uffff\1\53", - "\1\53\1\uffff\12\54\13\uffff\1\53\37\uffff\1\53", - "", - "", - "", - "", - "", - "\1\55", - "\1\56", - "\1\57", - "\1\60", - "\1\61", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "\1\63", - "\1\64\5\uffff\1\65", - "\1\66", - "\1\67", - "\1\70", - "\1\71", - "", - "", - "\1\53\1\uffff\12\54\13\uffff\1\53\37\uffff\1\53", - "\1\72", - "\1\73", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "\1\75", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "\1\100", - "\1\101", - "\1\102", - "\1\103", - "\1\104", - "\1\105", - "\1\106", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "", - "\1\110", - "", - "", - "\1\111", - "\1\112", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "\1\114", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "\1\116", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "\1\122", - "", - "\1\123", - "", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "", - "", - "", - "\1\125", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "", - "\12\26\7\uffff\32\26\6\uffff\32\26", - "", - "" - }; - - 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", "", "", "", "DECL", "DECLLIST", "DIGIT", "ESCAPE", - "EXPR", "FLOATCONST", "ID", "INTCONST", "INVALID", "MODIFIER", "PROGRAM", - "STAT", "STATLIST", "STRINGCONST", "TYPE", "UMINUS", "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__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 T__46=46; - public static final int DECL=4; - public static final int DECLLIST=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 UMINUS=19; - public static final int WS=20; - - // 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:62:1: program : 'program' ^ ID ';' ! decllist statlist '.' ! EOF !; - 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; - - try { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:62:8: ( 'program' ^ ID ';' ! decllist statlist '.' ! EOF !) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:62:17: 'program' ^ ID ';' ! decllist statlist '.' ! EOF ! - { - root_0 = (CommonTree)adaptor.nil(); - - - string_literal1=(Token)match(input,42,FOLLOW_42_in_program464); if (state.failed) return retval; - if ( state.backtracking==0 ) { - string_literal1_tree = (CommonTree)adaptor.create(string_literal1); - root_0 = (CommonTree)adaptor.becomeRoot(string_literal1_tree, root_0); - } - - ID2=(Token)match(input,ID,FOLLOW_ID_in_program467); if (state.failed) return retval; - if ( state.backtracking==0 ) { - ID2_tree = (CommonTree)adaptor.create(ID2); - adaptor.addChild(root_0, ID2_tree); - } - - char_literal3=(Token)match(input,30,FOLLOW_30_in_program469); if (state.failed) return retval; - pushFollow(FOLLOW_decllist_in_program472); - decllist4=decllist(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, decllist4.getTree()); - - pushFollow(FOLLOW_statlist_in_program474); - statlist5=statlist(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, statlist5.getTree()); - - char_literal6=(Token)match(input,26,FOLLOW_26_in_program476); if (state.failed) return retval; - EOF7=(Token)match(input,EOF,FOLLOW_EOF_in_program479); if (state.failed) return retval; - } - - 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:65:1: decllist : ( decl )* -> ^( DECLLIST ( decl )* ) ; - public final XParser.decllist_return decllist() throws RecognitionException { - XParser.decllist_return retval = new XParser.decllist_return(); - retval.start = input.LT(1); - - CommonTree root_0 = null; - - ParserRuleReturnScope decl8 =null; - - RewriteRuleSubtreeStream stream_decl=new RewriteRuleSubtreeStream(adaptor,"rule decl"); - - try { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:65:9: ( ( decl )* -> ^( DECLLIST ( decl )* ) ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:65:17: ( decl )* - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:65:17: ( decl )* - loop1: - while (true) { - int alt1=2; - int LA1_0 = input.LA(1); - if ( (LA1_0==ID||LA1_0==41||LA1_0==43) ) { - alt1=1; - } - - switch (alt1) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:65:17: decl - { - pushFollow(FOLLOW_decl_in_decllist494); - decl8=decl(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_decl.add(decl8.getTree()); - } - break; - - default : - break loop1; - } - } - - // AST REWRITE - // elements: decl - // 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(); - // 65:23: -> ^( DECLLIST ( decl )* ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:65:26: ^( DECLLIST ( decl )* ) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECLLIST, "DECLLIST"), root_1); - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:65:37: ( decl )* - while ( stream_decl.hasNext() ) { - adaptor.addChild(root_1, stream_decl.nextTree()); - } - stream_decl.reset(); - - adaptor.addChild(root_0, root_1); - } - - } - - - retval.tree = root_0; - } - - } - - retval.stop = input.LT(-1); - - 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:66: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 ID10=null; - Token char_literal11=null; - Token char_literal13=null; - ParserRuleReturnScope modifier9 =null; - ParserRuleReturnScope type12 =null; - - CommonTree ID10_tree=null; - CommonTree char_literal11_tree=null; - CommonTree char_literal13_tree=null; - RewriteRuleTokenStream stream_28=new RewriteRuleTokenStream(adaptor,"token 28"); - RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID"); - RewriteRuleTokenStream stream_30=new RewriteRuleTokenStream(adaptor,"token 30"); - 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:66: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:66:17: ( modifier )? ID ':' type ';' - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:66:17: ( modifier )? - int alt2=2; - int LA2_0 = input.LA(1); - if ( (LA2_0==41||LA2_0==43) ) { - alt2=1; - } - switch (alt2) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:66:17: modifier - { - pushFollow(FOLLOW_modifier_in_decl520); - modifier9=modifier(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_modifier.add(modifier9.getTree()); - } - break; - - } - - ID10=(Token)match(input,ID,FOLLOW_ID_in_decl523); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_ID.add(ID10); - - char_literal11=(Token)match(input,28,FOLLOW_28_in_decl525); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_28.add(char_literal11); - - pushFollow(FOLLOW_type_in_decl527); - type12=type(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_type.add(type12.getTree()); - char_literal13=(Token)match(input,30,FOLLOW_30_in_decl529); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_30.add(char_literal13); - - // AST REWRITE - // elements: ID, type, modifier - // 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:43: -> ^( DECL ( modifier )? ID type ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:66:46: ^( DECL ( modifier )? ID type ) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECL, "DECL"), root_1); - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:66:53: ( modifier )? - if ( stream_modifier.hasNext() ) { - adaptor.addChild(root_1, stream_modifier.nextTree()); - } - stream_modifier.reset(); - - 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:67: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_literal14=null; - Token string_literal15=null; - Token string_literal16=null; - Token string_literal17=null; - - CommonTree string_literal14_tree=null; - CommonTree string_literal15_tree=null; - CommonTree string_literal16_tree=null; - CommonTree string_literal17_tree=null; - - try { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:9: ( 'read' ( 'print' )? | 'read' | 'print' ) - int alt4=3; - int LA4_0 = input.LA(1); - if ( (LA4_0==43) ) { - int LA4_1 = input.LA(2); - if ( (synpred4_X()) ) { - alt4=1; - } - else if ( (synpred5_X()) ) { - alt4=2; - } - - else { - if (state.backtracking>0) {state.failed=true; return retval;} - int nvaeMark = input.mark(); - try { - input.consume(); - NoViableAltException nvae = - new NoViableAltException("", 4, 1, input); - throw nvae; - } finally { - input.rewind(nvaeMark); - } - } - - } - else if ( (LA4_0==41) ) { - alt4=3; - } - - else { - 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:67:17: 'read' ( 'print' )? - { - root_0 = (CommonTree)adaptor.nil(); - - - string_literal14=(Token)match(input,43,FOLLOW_43_in_modifier554); if (state.failed) return retval; - if ( state.backtracking==0 ) { - string_literal14_tree = (CommonTree)adaptor.create(string_literal14); - adaptor.addChild(root_0, string_literal14_tree); - } - - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:24: ( 'print' )? - int alt3=2; - int LA3_0 = input.LA(1); - if ( (LA3_0==41) ) { - alt3=1; - } - switch (alt3) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:24: 'print' - { - string_literal15=(Token)match(input,41,FOLLOW_41_in_modifier556); if (state.failed) return retval; - if ( state.backtracking==0 ) { - string_literal15_tree = (CommonTree)adaptor.create(string_literal15); - adaptor.addChild(root_0, string_literal15_tree); - } - - } - break; - - } - - } - break; - case 2 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:35: 'read' - { - root_0 = (CommonTree)adaptor.nil(); - - - string_literal16=(Token)match(input,43,FOLLOW_43_in_modifier561); 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; - case 3 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:44: 'print' - { - root_0 = (CommonTree)adaptor.nil(); - - - string_literal17=(Token)match(input,41,FOLLOW_41_in_modifier565); 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; - - } - 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:68: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 set18=null; - - CommonTree set18_tree=null; - - try { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:68: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(); - - - set18=input.LT(1); - if ( input.LA(1)==37||input.LA(1)==40||input.LA(1)==44 ) { - input.consume(); - if ( state.backtracking==0 ) adaptor.addChild(root_0, (CommonTree)adaptor.create(set18)); - 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:71: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_literal19=null; - Token char_literal21=null; - Token string_literal22=null; - ParserRuleReturnScope stat20 =null; - - CommonTree string_literal19_tree=null; - CommonTree char_literal21_tree=null; - CommonTree string_literal22_tree=null; - RewriteRuleTokenStream stream_34=new RewriteRuleTokenStream(adaptor,"token 34"); - RewriteRuleTokenStream stream_36=new RewriteRuleTokenStream(adaptor,"token 36"); - 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:71:9: ( 'begin' ( stat ';' )* 'end' -> ^( STATLIST ( stat )* ) ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:71:17: 'begin' ( stat ';' )* 'end' - { - string_literal19=(Token)match(input,34,FOLLOW_34_in_statlist603); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_34.add(string_literal19); - - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:71:25: ( stat ';' )* - loop5: - while (true) { - int alt5=2; - int LA5_0 = input.LA(1); - if ( (LA5_0==ID||LA5_0==34||(LA5_0 >= 38 && LA5_0 <= 39)||LA5_0==46) ) { - alt5=1; - } - - switch (alt5) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:71:26: stat ';' - { - pushFollow(FOLLOW_stat_in_statlist606); - stat20=stat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_stat.add(stat20.getTree()); - char_literal21=(Token)match(input,30,FOLLOW_30_in_statlist608); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_30.add(char_literal21); - - } - break; - - default : - break loop5; - } - } - - string_literal22=(Token)match(input,36,FOLLOW_36_in_statlist612); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_36.add(string_literal22); - - // 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(); - // 71:43: -> ^( STATLIST ( stat )* ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:71: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:71: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:72: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 assignstat23 =null; - ParserRuleReturnScope condstat24 =null; - ParserRuleReturnScope whilestat25 =null; - ParserRuleReturnScope forstat26 =null; - ParserRuleReturnScope statlist27 =null; - - - try { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:5: ( assignstat | condstat | whilestat | forstat | statlist ) - int alt6=5; - switch ( input.LA(1) ) { - case ID: - { - alt6=1; - } - break; - case 39: - { - alt6=2; - } - break; - case 46: - { - alt6=3; - } - break; - case 38: - { - alt6=4; - } - break; - case 34: - { - alt6=5; - } - 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:72:17: assignstat - { - root_0 = (CommonTree)adaptor.nil(); - - - pushFollow(FOLLOW_assignstat_in_stat637); - assignstat23=assignstat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, assignstat23.getTree()); - - } - break; - case 2 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:30: condstat - { - root_0 = (CommonTree)adaptor.nil(); - - - pushFollow(FOLLOW_condstat_in_stat641); - condstat24=condstat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, condstat24.getTree()); - - } - break; - case 3 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:41: whilestat - { - root_0 = (CommonTree)adaptor.nil(); - - - pushFollow(FOLLOW_whilestat_in_stat645); - whilestat25=whilestat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, whilestat25.getTree()); - - } - break; - case 4 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:53: forstat - { - root_0 = (CommonTree)adaptor.nil(); - - - pushFollow(FOLLOW_forstat_in_stat649); - forstat26=forstat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, forstat26.getTree()); - - } - break; - case 5 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:72:63: statlist - { - root_0 = (CommonTree)adaptor.nil(); - - - pushFollow(FOLLOW_statlist_in_stat653); - statlist27=statlist(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, statlist27.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:73: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 ID28=null; - Token string_literal29=null; - ParserRuleReturnScope expr30 =null; - - CommonTree ID28_tree=null; - CommonTree string_literal29_tree=null; - RewriteRuleTokenStream stream_29=new RewriteRuleTokenStream(adaptor,"token 29"); - 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:73:11: ( ID ':=' expr -> ^( ':=' ID expr ) ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:17: ID ':=' expr - { - ID28=(Token)match(input,ID,FOLLOW_ID_in_assignstat663); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_ID.add(ID28); - - string_literal29=(Token)match(input,29,FOLLOW_29_in_assignstat665); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_29.add(string_literal29); - - pushFollow(FOLLOW_expr_in_assignstat667); - expr30=expr(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_expr.add(expr30.getTree()); - // AST REWRITE - // elements: ID, expr, 29 - // 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:30: -> ^( ':=' ID expr ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:73:33: ^( ':=' ID expr ) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot(stream_29.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:74: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_literal31=null; - Token string_literal33=null; - ParserRuleReturnScope cond32 =null; - ParserRuleReturnScope stat34 =null; - ParserRuleReturnScope condElseStat35 =null; - - CommonTree string_literal31_tree=null; - CommonTree string_literal33_tree=null; - RewriteRuleTokenStream stream_45=new RewriteRuleTokenStream(adaptor,"token 45"); - RewriteRuleTokenStream stream_39=new RewriteRuleTokenStream(adaptor,"token 39"); - 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:74: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:74:17: 'if' cond 'then' stat ( condElseStat )? - { - string_literal31=(Token)match(input,39,FOLLOW_39_in_condstat689); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_39.add(string_literal31); - - pushFollow(FOLLOW_cond_in_condstat691); - cond32=cond(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_cond.add(cond32.getTree()); - string_literal33=(Token)match(input,45,FOLLOW_45_in_condstat693); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_45.add(string_literal33); - - pushFollow(FOLLOW_stat_in_condstat695); - stat34=stat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_stat.add(stat34.getTree()); - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:74:39: ( condElseStat )? - int alt7=2; - int LA7_0 = input.LA(1); - if ( (LA7_0==35) ) { - int LA7_1 = input.LA(2); - if ( (synpred13_X()) ) { - alt7=1; - } - } - switch (alt7) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:74:39: condElseStat - { - pushFollow(FOLLOW_condElseStat_in_condstat697); - condElseStat35=condElseStat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_condElseStat.add(condElseStat35.getTree()); - } - break; - - } - - // AST REWRITE - // elements: cond, 39, 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(); - // 74:53: -> ^( 'if' cond stat ( condElseStat )? ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:74:56: ^( 'if' cond stat ( condElseStat )? ) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot(stream_39.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:74: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:75: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_literal36=null; - ParserRuleReturnScope stat37 =null; - - CommonTree string_literal36_tree=null; - RewriteRuleTokenStream stream_35=new RewriteRuleTokenStream(adaptor,"token 35"); - 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:75:13: ( 'else' stat -> ^( 'else' stat ) ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:75:17: 'else' stat - { - string_literal36=(Token)match(input,35,FOLLOW_35_in_condElseStat720); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_35.add(string_literal36); - - pushFollow(FOLLOW_stat_in_condElseStat722); - stat37=stat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_stat.add(stat37.getTree()); - // AST REWRITE - // elements: 35, 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(); - // 75:29: -> ^( 'else' stat ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:75:32: ^( 'else' stat ) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot(stream_35.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:76: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_literal38=null; - Token char_literal39=null; - Token char_literal41=null; - ParserRuleReturnScope cond40 =null; - ParserRuleReturnScope stat42 =null; - - CommonTree string_literal38_tree=null; - CommonTree char_literal39_tree=null; - CommonTree char_literal41_tree=null; - RewriteRuleTokenStream stream_22=new RewriteRuleTokenStream(adaptor,"token 22"); - RewriteRuleTokenStream stream_46=new RewriteRuleTokenStream(adaptor,"token 46"); - 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:76: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:76:17: 'while' '(' cond ')' stat - { - string_literal38=(Token)match(input,46,FOLLOW_46_in_whilestat741); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_46.add(string_literal38); - - char_literal39=(Token)match(input,21,FOLLOW_21_in_whilestat743); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_21.add(char_literal39); - - pushFollow(FOLLOW_cond_in_whilestat745); - cond40=cond(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_cond.add(cond40.getTree()); - char_literal41=(Token)match(input,22,FOLLOW_22_in_whilestat747); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_22.add(char_literal41); - - pushFollow(FOLLOW_stat_in_whilestat749); - stat42=stat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_stat.add(stat42.getTree()); - // AST REWRITE - // elements: cond, stat, 46 - // 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:43: -> ^( 'while' cond stat ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:76:46: ^( 'while' cond stat ) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot(stream_46.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:77: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_literal43=null; - Token char_literal44=null; - Token char_literal46=null; - Token char_literal48=null; - Token char_literal50=null; - ParserRuleReturnScope assignstat45 =null; - ParserRuleReturnScope cond47 =null; - ParserRuleReturnScope assignstat49 =null; - ParserRuleReturnScope stat51 =null; - - CommonTree string_literal43_tree=null; - CommonTree char_literal44_tree=null; - CommonTree char_literal46_tree=null; - CommonTree char_literal48_tree=null; - CommonTree char_literal50_tree=null; - RewriteRuleTokenStream stream_22=new RewriteRuleTokenStream(adaptor,"token 22"); - RewriteRuleTokenStream stream_38=new RewriteRuleTokenStream(adaptor,"token 38"); - RewriteRuleTokenStream stream_30=new RewriteRuleTokenStream(adaptor,"token 30"); - 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:77: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:77:17: 'for' '(' assignstat ';' cond ';' assignstat ')' stat - { - string_literal43=(Token)match(input,38,FOLLOW_38_in_forstat772); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_38.add(string_literal43); - - char_literal44=(Token)match(input,21,FOLLOW_21_in_forstat774); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_21.add(char_literal44); - - pushFollow(FOLLOW_assignstat_in_forstat776); - assignstat45=assignstat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_assignstat.add(assignstat45.getTree()); - char_literal46=(Token)match(input,30,FOLLOW_30_in_forstat778); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_30.add(char_literal46); - - pushFollow(FOLLOW_cond_in_forstat780); - cond47=cond(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_cond.add(cond47.getTree()); - char_literal48=(Token)match(input,30,FOLLOW_30_in_forstat782); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_30.add(char_literal48); - - pushFollow(FOLLOW_assignstat_in_forstat784); - assignstat49=assignstat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_assignstat.add(assignstat49.getTree()); - char_literal50=(Token)match(input,22,FOLLOW_22_in_forstat786); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_22.add(char_literal50); - - pushFollow(FOLLOW_stat_in_forstat788); - stat51=stat(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_stat.add(stat51.getTree()); - // AST REWRITE - // elements: cond, stat, assignstat, 38, 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(); - // 78:17: -> ^( 'for' assignstat cond assignstat stat ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:78:20: ^( 'for' assignstat cond assignstat stat ) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot(stream_38.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 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:81: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 set52=null; - - CommonTree set52_tree=null; - - try { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:81: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(); - - - set52=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(set52)); - 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 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:82:1: expr : ( expr2 (op= '+' |op= '-' ) expr -> ^( $op expr2 expr ) | 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 op=null; - ParserRuleReturnScope expr253 =null; - ParserRuleReturnScope expr54 =null; - ParserRuleReturnScope expr255 =null; - - CommonTree op_tree=null; - RewriteRuleTokenStream stream_24=new RewriteRuleTokenStream(adaptor,"token 24"); - RewriteRuleTokenStream stream_25=new RewriteRuleTokenStream(adaptor,"token 25"); - 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:82:5: ( expr2 (op= '+' |op= '-' ) expr -> ^( $op expr2 expr ) | expr2 ) - int alt9=2; - switch ( input.LA(1) ) { - case 25: - { - int LA9_1 = input.LA(2); - if ( (synpred16_X()) ) { - alt9=1; - } - else if ( (true) ) { - alt9=2; - } - - } - break; - case FLOATCONST: - case INTCONST: - { - int LA9_2 = input.LA(2); - if ( (synpred16_X()) ) { - alt9=1; - } - else if ( (true) ) { - alt9=2; - } - - } - break; - case STRINGCONST: - { - int LA9_3 = input.LA(2); - if ( (synpred16_X()) ) { - alt9=1; - } - else if ( (true) ) { - alt9=2; - } - - } - break; - case 21: - { - int LA9_4 = input.LA(2); - if ( (synpred16_X()) ) { - alt9=1; - } - else if ( (true) ) { - alt9=2; - } - - } - break; - default: - if (state.backtracking>0) {state.failed=true; return retval;} - NoViableAltException nvae = - new NoViableAltException("", 9, 0, input); - throw nvae; - } - switch (alt9) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:13: expr2 (op= '+' |op= '-' ) expr - { - pushFollow(FOLLOW_expr2_in_expr846); - expr253=expr2(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_expr2.add(expr253.getTree()); - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:19: (op= '+' |op= '-' ) - int alt8=2; - int LA8_0 = input.LA(1); - if ( (LA8_0==24) ) { - alt8=1; - } - else if ( (LA8_0==25) ) { - alt8=2; - } - - else { - 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:82:20: op= '+' - { - op=(Token)match(input,24,FOLLOW_24_in_expr851); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_24.add(op); - - } - break; - case 2 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:29: op= '-' - { - op=(Token)match(input,25,FOLLOW_25_in_expr857); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_25.add(op); - - } - break; - - } - - pushFollow(FOLLOW_expr_in_expr860); - expr54=expr(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_expr.add(expr54.getTree()); - // AST REWRITE - // elements: op, expr, expr2 - // token labels: op - // rule labels: retval - // token list labels: - // rule list labels: - // wildcard labels: - if ( state.backtracking==0 ) { - retval.tree = root_0; - RewriteRuleTokenStream stream_op=new RewriteRuleTokenStream(adaptor,"token op",op); - RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); - - root_0 = (CommonTree)adaptor.nil(); - // 82:45: -> ^( $op expr2 expr ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:48: ^( $op expr2 expr ) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot(stream_op.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:83:15: expr2 - { - root_0 = (CommonTree)adaptor.nil(); - - - pushFollow(FOLLOW_expr2_in_expr890); - expr255=expr2(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, expr255.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 "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 (op= '*' |op= '/' ) expr -> ^( $op expr3 expr ) | 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 op=null; - ParserRuleReturnScope expr356 =null; - ParserRuleReturnScope expr57 =null; - ParserRuleReturnScope expr358 =null; - - CommonTree op_tree=null; - RewriteRuleTokenStream stream_23=new RewriteRuleTokenStream(adaptor,"token 23"); - RewriteRuleTokenStream stream_27=new RewriteRuleTokenStream(adaptor,"token 27"); - RewriteRuleSubtreeStream stream_expr3=new RewriteRuleSubtreeStream(adaptor,"rule expr3"); - 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:84:6: ( expr3 (op= '*' |op= '/' ) expr -> ^( $op expr3 expr ) | expr3 ) - int alt11=2; - switch ( input.LA(1) ) { - case 25: - { - int LA11_1 = input.LA(2); - if ( (synpred18_X()) ) { - alt11=1; - } - else if ( (true) ) { - alt11=2; - } - - } - break; - case FLOATCONST: - case INTCONST: - { - int LA11_2 = input.LA(2); - if ( (synpred18_X()) ) { - alt11=1; - } - else if ( (true) ) { - alt11=2; - } - - } - break; - case STRINGCONST: - { - int LA11_3 = input.LA(2); - if ( (synpred18_X()) ) { - alt11=1; - } - else if ( (true) ) { - alt11=2; - } - - } - break; - case 21: - { - int LA11_4 = input.LA(2); - if ( (synpred18_X()) ) { - alt11=1; - } - else if ( (true) ) { - alt11=2; - } - - } - break; - default: - if (state.backtracking>0) {state.failed=true; return retval;} - NoViableAltException nvae = - new NoViableAltException("", 11, 0, input); - throw nvae; - } - switch (alt11) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:13: expr3 (op= '*' |op= '/' ) expr - { - pushFollow(FOLLOW_expr3_in_expr2901); - expr356=expr3(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_expr3.add(expr356.getTree()); - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:19: (op= '*' |op= '/' ) - int alt10=2; - int LA10_0 = input.LA(1); - if ( (LA10_0==23) ) { - alt10=1; - } - else if ( (LA10_0==27) ) { - alt10=2; - } - - else { - if (state.backtracking>0) {state.failed=true; return retval;} - NoViableAltException nvae = - new NoViableAltException("", 10, 0, input); - throw nvae; - } - - switch (alt10) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:20: op= '*' - { - op=(Token)match(input,23,FOLLOW_23_in_expr2906); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_23.add(op); - - } - break; - case 2 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:29: op= '/' - { - op=(Token)match(input,27,FOLLOW_27_in_expr2912); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_27.add(op); - - } - break; - - } - - pushFollow(FOLLOW_expr_in_expr2915); - expr57=expr(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_expr.add(expr57.getTree()); - // AST REWRITE - // elements: expr3, op, expr - // token labels: op - // rule labels: retval - // token list labels: - // rule list labels: - // wildcard labels: - if ( state.backtracking==0 ) { - retval.tree = root_0; - RewriteRuleTokenStream stream_op=new RewriteRuleTokenStream(adaptor,"token op",op); - RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); - - root_0 = (CommonTree)adaptor.nil(); - // 84:45: -> ^( $op expr3 expr ) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:48: ^( $op expr3 expr ) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot(stream_op.nextNode(), root_1); - adaptor.addChild(root_1, stream_expr3.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:85:15: expr3 - { - root_0 = (CommonTree)adaptor.nil(); - - - pushFollow(FOLLOW_expr3_in_expr2945); - expr358=expr3(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, expr358.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 "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:86:1: expr3 : (op= '-' num= number -> ^( UMINUS[op,\"UMINUS\"] $num) | 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 op=null; - Token STRINGCONST60=null; - Token char_literal61=null; - Token char_literal63=null; - ParserRuleReturnScope num =null; - ParserRuleReturnScope number59 =null; - ParserRuleReturnScope expr62 =null; - - CommonTree op_tree=null; - CommonTree STRINGCONST60_tree=null; - CommonTree char_literal61_tree=null; - CommonTree char_literal63_tree=null; - RewriteRuleTokenStream stream_25=new RewriteRuleTokenStream(adaptor,"token 25"); - RewriteRuleSubtreeStream stream_number=new RewriteRuleSubtreeStream(adaptor,"rule number"); - - try { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86:6: (op= '-' num= number -> ^( UMINUS[op,\"UMINUS\"] $num) | number | STRINGCONST | '(' ! expr ^ ')' !) - int alt12=4; - switch ( input.LA(1) ) { - case 25: - { - alt12=1; - } - break; - case FLOATCONST: - case INTCONST: - { - alt12=2; - } - break; - case STRINGCONST: - { - alt12=3; - } - break; - case 21: - { - alt12=4; - } - break; - default: - if (state.backtracking>0) {state.failed=true; return retval;} - NoViableAltException nvae = - new NoViableAltException("", 12, 0, input); - throw nvae; - } - switch (alt12) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86:13: op= '-' num= number - { - op=(Token)match(input,25,FOLLOW_25_in_expr3958); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_25.add(op); - - pushFollow(FOLLOW_number_in_expr3962); - num=number(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) stream_number.add(num.getTree()); - // AST REWRITE - // elements: num - // token labels: - // rule labels: num, retval - // token list labels: - // rule list labels: - // wildcard labels: - if ( state.backtracking==0 ) { - retval.tree = root_0; - RewriteRuleSubtreeStream stream_num=new RewriteRuleSubtreeStream(adaptor,"rule num",num!=null?num.getTree():null); - RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); - - root_0 = (CommonTree)adaptor.nil(); - // 86:45: -> ^( UMINUS[op,\"UMINUS\"] $num) - { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:86:48: ^( UMINUS[op,\"UMINUS\"] $num) - { - CommonTree root_1 = (CommonTree)adaptor.nil(); - root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UMINUS, op, "UMINUS"), root_1); - adaptor.addChild(root_1, stream_num.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: number - { - root_0 = (CommonTree)adaptor.nil(); - - - pushFollow(FOLLOW_number_in_expr31002); - number59=number(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, number59.getTree()); - - } - break; - case 3 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:24: STRINGCONST - { - root_0 = (CommonTree)adaptor.nil(); - - - STRINGCONST60=(Token)match(input,STRINGCONST,FOLLOW_STRINGCONST_in_expr31006); if (state.failed) return retval; - if ( state.backtracking==0 ) { - STRINGCONST60_tree = (CommonTree)adaptor.create(STRINGCONST60); - adaptor.addChild(root_0, STRINGCONST60_tree); - } - - } - break; - case 4 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:87:38: '(' ! expr ^ ')' ! - { - root_0 = (CommonTree)adaptor.nil(); - - - char_literal61=(Token)match(input,21,FOLLOW_21_in_expr31010); if (state.failed) return retval; - pushFollow(FOLLOW_expr_in_expr31013); - expr62=expr(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) root_0 = (CommonTree)adaptor.becomeRoot(expr62.getTree(), root_0); - char_literal63=(Token)match(input,22,FOLLOW_22_in_expr31016); if (state.failed) return retval; - } - 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 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 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: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(); - - - set64=input.LT(1); - if ( (input.LA(1) >= 31 && input.LA(1) <= 33) ) { - 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 "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 expr65 =null; - ParserRuleReturnScope cond266 =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_cond1049); - expr65=expr(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, expr65.getTree()); - - pushFollow(FOLLOW_cond2_in_cond1051); - cond266=cond2(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, cond266.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 compOp67 =null; - ParserRuleReturnScope expr68 =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_cond21062); - compOp67=compOp(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, compOp67.getTree()); - - pushFollow(FOLLOW_expr_in_cond21064); - expr68=expr(); - state._fsp--; - if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, expr68.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" - - // $ANTLR start synpred4_X - public final void synpred4_X_fragment() throws RecognitionException { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:17: ( 'read' ( 'print' )? ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:17: 'read' ( 'print' )? - { - match(input,43,FOLLOW_43_in_synpred4_X554); if (state.failed) return; - - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:24: ( 'print' )? - int alt13=2; - int LA13_0 = input.LA(1); - if ( (LA13_0==41) ) { - alt13=1; - } - switch (alt13) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:24: 'print' - { - match(input,41,FOLLOW_41_in_synpred4_X556); if (state.failed) return; - - } - break; - - } - - } - - } - // $ANTLR end synpred4_X - - // $ANTLR start synpred5_X - public final void synpred5_X_fragment() throws RecognitionException { - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:35: ( 'read' ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:67:35: 'read' - { - match(input,43,FOLLOW_43_in_synpred5_X561); if (state.failed) return; - - } - - } - // $ANTLR end synpred5_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:74:39: ( condElseStat ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:74:39: condElseStat - { - pushFollow(FOLLOW_condElseStat_in_synpred13_X697); - condElseStat(); - state._fsp--; - if (state.failed) return; - - } - - } - // $ANTLR end synpred13_X - - // $ANTLR start synpred16_X - public final void synpred16_X_fragment() throws RecognitionException { - Token op=null; - - - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:13: ( expr2 (op= '+' |op= '-' ) expr ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:13: expr2 (op= '+' |op= '-' ) expr - { - pushFollow(FOLLOW_expr2_in_synpred16_X846); - expr2(); - state._fsp--; - if (state.failed) return; - - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:19: (op= '+' |op= '-' ) - int alt14=2; - int LA14_0 = input.LA(1); - if ( (LA14_0==24) ) { - alt14=1; - } - else if ( (LA14_0==25) ) { - alt14=2; - } - - else { - if (state.backtracking>0) {state.failed=true; return;} - NoViableAltException nvae = - new NoViableAltException("", 14, 0, input); - throw nvae; - } - - switch (alt14) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:20: op= '+' - { - op=(Token)match(input,24,FOLLOW_24_in_synpred16_X851); if (state.failed) return; - - } - break; - case 2 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:82:29: op= '-' - { - op=(Token)match(input,25,FOLLOW_25_in_synpred16_X857); if (state.failed) return; - - } - break; - - } - - pushFollow(FOLLOW_expr_in_synpred16_X860); - expr(); - state._fsp--; - if (state.failed) return; - - } - - } - // $ANTLR end synpred16_X - - // $ANTLR start synpred18_X - public final void synpred18_X_fragment() throws RecognitionException { - Token op=null; - - - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:13: ( expr3 (op= '*' |op= '/' ) expr ) - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:13: expr3 (op= '*' |op= '/' ) expr - { - pushFollow(FOLLOW_expr3_in_synpred18_X901); - expr3(); - state._fsp--; - if (state.failed) return; - - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:19: (op= '*' |op= '/' ) - int alt15=2; - int LA15_0 = input.LA(1); - if ( (LA15_0==23) ) { - alt15=1; - } - else if ( (LA15_0==27) ) { - alt15=2; - } - - else { - if (state.backtracking>0) {state.failed=true; return;} - NoViableAltException nvae = - new NoViableAltException("", 15, 0, input); - throw nvae; - } - - switch (alt15) { - case 1 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:20: op= '*' - { - op=(Token)match(input,23,FOLLOW_23_in_synpred18_X906); if (state.failed) return; - - } - break; - case 2 : - // C:\\Development\\Schule\\Compilerbau\\CC-Praxis-Antlr Parser fuer X-Leer\\src/de/dhbw/compiler/antlrxparser/X.g:84:29: op= '/' - { - op=(Token)match(input,27,FOLLOW_27_in_synpred18_X912); if (state.failed) return; - - } - break; - - } - - pushFollow(FOLLOW_expr_in_synpred18_X915); - expr(); - state._fsp--; - if (state.failed) return; - - } - - } - // $ANTLR end synpred18_X - - // Delegated rules - - public final boolean synpred16_X() { - state.backtracking++; - int start = input.mark(); - try { - synpred16_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 synpred5_X() { - state.backtracking++; - int start = input.mark(); - try { - synpred5_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 synpred4_X() { - state.backtracking++; - int start = input.mark(); - try { - synpred4_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 synpred18_X() { - state.backtracking++; - int start = input.mark(); - try { - synpred18_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_42_in_program464 = new BitSet(new long[]{0x0000000000000400L}); - public static final BitSet FOLLOW_ID_in_program467 = new BitSet(new long[]{0x0000000040000000L}); - public static final BitSet FOLLOW_30_in_program469 = new BitSet(new long[]{0x00000A0400000400L}); - public static final BitSet FOLLOW_decllist_in_program472 = new BitSet(new long[]{0x0000000400000000L}); - public static final BitSet FOLLOW_statlist_in_program474 = new BitSet(new long[]{0x0000000004000000L}); - public static final BitSet FOLLOW_26_in_program476 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_program479 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_decl_in_decllist494 = new BitSet(new long[]{0x00000A0000000402L}); - public static final BitSet FOLLOW_modifier_in_decl520 = new BitSet(new long[]{0x0000000000000400L}); - public static final BitSet FOLLOW_ID_in_decl523 = new BitSet(new long[]{0x0000000010000000L}); - public static final BitSet FOLLOW_28_in_decl525 = new BitSet(new long[]{0x0000112000000000L}); - public static final BitSet FOLLOW_type_in_decl527 = new BitSet(new long[]{0x0000000040000000L}); - public static final BitSet FOLLOW_30_in_decl529 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_43_in_modifier554 = new BitSet(new long[]{0x0000020000000002L}); - public static final BitSet FOLLOW_41_in_modifier556 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_43_in_modifier561 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_41_in_modifier565 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_34_in_statlist603 = new BitSet(new long[]{0x000040D400000400L}); - public static final BitSet FOLLOW_stat_in_statlist606 = new BitSet(new long[]{0x0000000040000000L}); - public static final BitSet FOLLOW_30_in_statlist608 = new BitSet(new long[]{0x000040D400000400L}); - public static final BitSet FOLLOW_36_in_statlist612 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_assignstat_in_stat637 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_condstat_in_stat641 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_whilestat_in_stat645 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_forstat_in_stat649 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_statlist_in_stat653 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ID_in_assignstat663 = new BitSet(new long[]{0x0000000020000000L}); - public static final BitSet FOLLOW_29_in_assignstat665 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_expr_in_assignstat667 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_39_in_condstat689 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_cond_in_condstat691 = new BitSet(new long[]{0x0000200000000000L}); - public static final BitSet FOLLOW_45_in_condstat693 = new BitSet(new long[]{0x000040C400000400L}); - public static final BitSet FOLLOW_stat_in_condstat695 = new BitSet(new long[]{0x0000000800000002L}); - public static final BitSet FOLLOW_condElseStat_in_condstat697 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_35_in_condElseStat720 = new BitSet(new long[]{0x000040C400000400L}); - public static final BitSet FOLLOW_stat_in_condElseStat722 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_46_in_whilestat741 = new BitSet(new long[]{0x0000000000200000L}); - public static final BitSet FOLLOW_21_in_whilestat743 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_cond_in_whilestat745 = new BitSet(new long[]{0x0000000000400000L}); - public static final BitSet FOLLOW_22_in_whilestat747 = new BitSet(new long[]{0x000040C400000400L}); - public static final BitSet FOLLOW_stat_in_whilestat749 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_38_in_forstat772 = new BitSet(new long[]{0x0000000000200000L}); - public static final BitSet FOLLOW_21_in_forstat774 = new BitSet(new long[]{0x0000000000000400L}); - public static final BitSet FOLLOW_assignstat_in_forstat776 = new BitSet(new long[]{0x0000000040000000L}); - public static final BitSet FOLLOW_30_in_forstat778 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_cond_in_forstat780 = new BitSet(new long[]{0x0000000040000000L}); - public static final BitSet FOLLOW_30_in_forstat782 = new BitSet(new long[]{0x0000000000000400L}); - public static final BitSet FOLLOW_assignstat_in_forstat784 = new BitSet(new long[]{0x0000000000400000L}); - public static final BitSet FOLLOW_22_in_forstat786 = new BitSet(new long[]{0x000040C400000400L}); - public static final BitSet FOLLOW_stat_in_forstat788 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_expr2_in_expr846 = new BitSet(new long[]{0x0000000003000000L}); - public static final BitSet FOLLOW_24_in_expr851 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_25_in_expr857 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_expr_in_expr860 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_expr2_in_expr890 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_expr3_in_expr2901 = new BitSet(new long[]{0x0000000008800000L}); - public static final BitSet FOLLOW_23_in_expr2906 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_27_in_expr2912 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_expr_in_expr2915 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_expr3_in_expr2945 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_25_in_expr3958 = new BitSet(new long[]{0x0000000000000A00L}); - public static final BitSet FOLLOW_number_in_expr3962 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_number_in_expr31002 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_STRINGCONST_in_expr31006 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_21_in_expr31010 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_expr_in_expr31013 = new BitSet(new long[]{0x0000000000400000L}); - public static final BitSet FOLLOW_22_in_expr31016 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_expr_in_cond1049 = new BitSet(new long[]{0x0000000380000000L}); - public static final BitSet FOLLOW_cond2_in_cond1051 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_compOp_in_cond21062 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_expr_in_cond21064 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_43_in_synpred4_X554 = new BitSet(new long[]{0x0000020000000002L}); - public static final BitSet FOLLOW_41_in_synpred4_X556 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_43_in_synpred5_X561 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_condElseStat_in_synpred13_X697 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_expr2_in_synpred16_X846 = new BitSet(new long[]{0x0000000003000000L}); - public static final BitSet FOLLOW_24_in_synpred16_X851 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_25_in_synpred16_X857 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_expr_in_synpred16_X860 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_expr3_in_synpred18_X901 = new BitSet(new long[]{0x0000000008800000L}); - public static final BitSet FOLLOW_23_in_synpred18_X906 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_27_in_synpred18_X912 = new BitSet(new long[]{0x0000000002220A00L}); - public static final BitSet FOLLOW_expr_in_synpred18_X915 = new BitSet(new long[]{0x0000000000000002L}); -} diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/AntlrX.tokens b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/AntlrX.tokens deleted file mode 100644 index 5e3d994..0000000 --- a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/AntlrX.tokens +++ /dev/null @@ -1,68 +0,0 @@ -T__20=20 -T__21=21 -T__22=22 -T__23=23 -T__24=24 -T__25=25 -T__26=26 -T__27=27 -T__28=28 -T__29=29 -T__30=30 -T__31=31 -T__32=32 -T__33=33 -T__34=34 -T__35=35 -T__36=36 -T__37=37 -T__38=38 -T__39=39 -T__40=40 -T__41=41 -T__42=42 -T__43=43 -T__44=44 -T__45=45 -COMMENT=4 -DECL=5 -DECLLIST=6 -DIGIT=7 -FLOATCONST=8 -ID=9 -INTCONST=10 -INVALID=11 -LETTER=12 -OTHER=13 -POSDIGIT=14 -STATLIST=15 -STRINGCONST=16 -UMINUS=17 -WS=18 -ZERO=19 -'('=20 -')'=21 -'*'=22 -'+'=23 -'-'=24 -'.'=25 -'/'=26 -':'=27 -':='=28 -';'=29 -'<'=30 -'='=31 -'>'=32 -'begin'=33 -'else'=34 -'end'=35 -'float'=36 -'for'=37 -'if'=38 -'int'=39 -'print'=40 -'program'=41 -'read'=42 -'string'=43 -'then'=44 -'while'=45 diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/AntlrXParserMain.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/AntlrXParserMain.class deleted file mode 100644 index e12f960..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/AntlrXParserMain.class and /dev/null differ 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 deleted file mode 100644 index d892806..0000000 --- a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/X.g +++ /dev/null @@ -1,92 +0,0 @@ -/* ********************************************** - * Duale Hochschule Baden-Württemberg Karlsruhe - * Prof. Dr. Jörn Eisenbiegler - * - * Vorlesung Übersetzerbau - * Praxis ANTLR-Parser für X - * - Grammatik für Scanner und Parser - * - * ********************************************** - */ - -grammar X; - -options { - language = Java; - output = AST; - ASTLabelType = CommonTree; - backtrack = true; -} - -// AST-Tokens -tokens { - ID; - INTCONST; - FLOATCONST; - WS; - MODIFIER; - DECLLIST; - UMINUS; - PROGRAM; - DECL; - TYPE; - STAT; - STATLIST; - EXPR; - INVALID; -} - -@parser::header {package de.dhbw.compiler.antlrxparser;} -@lexer::header {package de.dhbw.compiler.antlrxparser;} - -// Anmerkung: Es müssen Lexer- UND Parser-Regeln stehen, da sonst das Generieren nicht funktionieren -// Lexer stuff -ID: ('a'..'z' | 'A'..'Z') - (options { - greedy = true; // Lese alle möglichen Zeichen ein -> Zahlen in ID -> bleibt weiterhin ID - }: 'a'..'z' | 'A'..'Z' | '0'..'9')*; - -INTCONST: '0' | ('1'..'9') ('0'..'9')*; -FLOATCONST: INTCONST ('.' DIGIT*)? ('e'|'E')('+' |'-' )? INTCONST - | INTCONST ('.' DIGIT*)?; - -STRINGCONST: '"' (ESCAPE | ~('\\' | '"'))* '"'; -ESCAPE: '\\' ('\"' |'\'' | '\\'); - -WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); }; - -fragment DIGIT: ('0'..'9'); - - -// -- Parser stuff -program: 'program'^ ID ';'! decllist statlist '.'! EOF!; - -// Declaration -decllist: decl* -> ^(DECLLIST decl*); -decl: modifier? ID ':' type ';' -> ^(DECL modifier? ID type); -modifier: 'read' 'print'? | 'read' | 'print'; -type: 'int' | 'float' | 'string'; - -// Block -statlist: 'begin' (stat ';')* 'end' -> ^(STATLIST stat*); -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); -whilestat: 'while' '(' cond ')' stat -> ^('while' cond stat); -forstat: 'for' '(' assignstat ';' cond ';' assignstat ')' stat - -> ^('for' assignstat cond assignstat stat); - -// Expressions -number: INTCONST | FLOATCONST; -expr: expr2 (op='+' | op='-') expr -> ^($op expr2 expr) - | expr2; -expr2: expr3 (op='*' | op='/') expr -> ^($op expr3 expr) - | expr3; -expr3: op='-' num=number -> ^(UMINUS[op,"UMINUS"] $num) - | number | STRINGCONST | '('! expr^ ')'!; - -// Conditions and comparison -compOp: '<' | '>' | '='; -cond: expr cond2; -cond2: compOp expr; 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 deleted file mode 100644 index e3113d8..0000000 --- a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/X.tokens +++ /dev/null @@ -1,69 +0,0 @@ -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 -T__46=46 -DECL=4 -DECLLIST=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 -UMINUS=19 -WS=20 -'('=21 -')'=22 -'*'=23 -'+'=24 -'-'=25 -'.'=26 -'/'=27 -':'=28 -':='=29 -';'=30 -'<'=31 -'='=32 -'>'=33 -'begin'=34 -'else'=35 -'end'=36 -'float'=37 -'for'=38 -'if'=39 -'int'=40 -'print'=41 -'program'=42 -'read'=43 -'string'=44 -'then'=45 -'while'=46 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 deleted file mode 100644 index 0867e6d..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA12.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 deleted file mode 100644 index fcf7a54..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer$DFA9.class and /dev/null 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 deleted file mode 100644 index 91d65e0..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XLexer.class and /dev/null 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 deleted file mode 100644 index d82a3e9..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$assignstat_return.class and /dev/null 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 deleted file mode 100644 index 3a37e60..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$compOp_return.class and /dev/null 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 deleted file mode 100644 index 70d8f2c..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$cond2_return.class and /dev/null 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 deleted file mode 100644 index 1f2c1ee..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$condElseStat_return.class and /dev/null 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 deleted file mode 100644 index 6152dec..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$cond_return.class and /dev/null 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 deleted file mode 100644 index a112f0e..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$condstat_return.class and /dev/null 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 deleted file mode 100644 index 5dc301f..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$decl_return.class and /dev/null 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 deleted file mode 100644 index 33f687a..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$decllist_return.class and /dev/null 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 deleted file mode 100644 index 28f8e11..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr2_return.class and /dev/null 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 deleted file mode 100644 index cd9c5bc..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr3_return.class and /dev/null 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 deleted file mode 100644 index e802c5b..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$expr_return.class and /dev/null 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 deleted file mode 100644 index 5d2606a..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$forstat_return.class and /dev/null 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 deleted file mode 100644 index e946719..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$modifier_return.class and /dev/null 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 deleted file mode 100644 index 505a258..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$number_return.class and /dev/null 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 deleted file mode 100644 index 8c9ba4f..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$program_return.class and /dev/null 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 deleted file mode 100644 index 78e11b3..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$stat_return.class and /dev/null 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 deleted file mode 100644 index 683cf5f..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$statlist_return.class and /dev/null 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 deleted file mode 100644 index 7c88abe..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$type_return.class and /dev/null 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 deleted file mode 100644 index 5bea62c..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser$whilestat_return.class and /dev/null 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 deleted file mode 100644 index 8dc7cfa..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/XParser.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/ParseTreeTest.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/ParseTreeTest.class deleted file mode 100644 index 175ae62..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/ParseTreeTest.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXParser.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXParser.class deleted file mode 100644 index 225fb2f..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXParser.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXParser1.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXParser1.class deleted file mode 100644 index 635ea3c..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXParser1.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXParser2.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXParser2.class deleted file mode 100644 index 97138a5..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXParser2.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXScanner1.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXScanner1.class deleted file mode 100644 index 9b60b02..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXScanner1.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXScanner2.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXScanner2.class deleted file mode 100644 index 8fcbdcd..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXScanner2.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXScanner3.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXScanner3.class deleted file mode 100644 index 528ce41..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestAntlrXScanner3.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestToken.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestToken.class deleted file mode 100644 index 3bbea5c..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TestToken.class and /dev/null differ diff --git a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TokenStreamTest.class b/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TokenStreamTest.class deleted file mode 100644 index 4d92506..0000000 Binary files a/out/production/CC-Praxis-Antlr Parser fuer X-Leer/de/dhbw/compiler/antlrxparser/test/TokenStreamTest.class and /dev/null differ diff --git a/out/production/ÜB-Praxis-Abstiegsparser für X-Leer/de/dhbw/compiler/xparser/JFlexXScanner.lex b/out/production/ÜB-Praxis-Abstiegsparser für X-Leer/de/dhbw/compiler/xparser/JFlexXScanner.lex deleted file mode 100644 index 9373246..0000000 --- a/out/production/ÜB-Praxis-Abstiegsparser für X-Leer/de/dhbw/compiler/xparser/JFlexXScanner.lex +++ /dev/null @@ -1,148 +0,0 @@ -/* ********************************************** - * Duale Hochschule Baden-Württemberg Karlsruhe - * Prof. Dr. Jörn Eisenbiegler - * - * Vorlesung Übersetzerbau - * Praxis X Abstiegsparser - * - Scanner-Definition - * - * ********************************************** - */ - - -package de.dhbw.compiler.xparser; - -%% - -%class JFlexXScanner -%type Token -%function nextToken - - -%unicode -%line -%column - -%public -%final - -%xstate INT, FRACTION, EXPVZ, EXP, STRING - -%{ - private int intvalue=0; - private String textvalue =""; - private int fracvalue=0; - private int fraclength=0; - private int expvalue=0; - private int expsign=1; - private int startline =0; - private int startcolumn =0; - private String stringvalue=""; -%} - - - -%% - -read { return new Token(Token.READ, yytext(), yyline+1, yycolumn+1); } -print { return new Token(Token.PRINT, yytext(), yyline+1, yycolumn+1); } -int { return new Token(Token.INT, yytext(), yyline+1, yycolumn+1); } -float { return new Token(Token.FLOAT, yytext(), yyline+1, yycolumn+1); } -string { return new Token(Token.STRING, yytext(), yyline+1, yycolumn+1); } -\+ { return new Token(Token.PLUS, yytext(), yyline+1, yycolumn+1); } -\- { return new Token(Token.MINUS, yytext(), yyline+1, yycolumn+1); } -\* { return new Token(Token.MULT, yytext(), yyline+1, yycolumn+1); } -\/ { return new Token(Token.DIV, yytext(), yyline+1, yycolumn+1); } -:= { return new Token(Token.ASSIGN, yytext(), yyline+1, yycolumn+1); } -\( { return new Token(Token.LBR, yytext(), yyline+1, yycolumn+1); } -\) { return new Token(Token.RBR, yytext(), yyline+1, yycolumn+1); } -\< { return new Token(Token.LESS, yytext(), yyline+1, yycolumn+1); } -> { return new Token(Token.MORE, yytext(), yyline+1, yycolumn+1); } -= { return new Token(Token.EQUALS, yytext(), yyline+1, yycolumn+1); } -if { return new Token(Token.IF, yytext(), yyline+1, yycolumn+1); } -then { return new Token(Token.THEN, yytext(), yyline+1, yycolumn+1); } -else { return new Token(Token.ELSE, yytext(), yyline+1, yycolumn+1); } -while { return new Token(Token.WHILE, yytext(), yyline+1, yycolumn+1); } -for { return new Token(Token.FOR, yytext(), yyline+1, yycolumn+1); } -; { return new Token(Token.SEMICOLON, yytext(), yyline+1, yycolumn+1); } -begin { return new Token(Token.BEGIN, yytext(), yyline+1, yycolumn+1); } -end { return new Token(Token.END, yytext(), yyline+1, yycolumn+1); } -program { return new Token(Token.PROGRAM, yytext(), yyline+1, yycolumn+1); } -\. { return new Token(Token.DOT, yytext(), yyline+1, yycolumn+1); } -: { return new Token(Token.COLON, yytext(), yyline+1, yycolumn+1); } - - -[a-zA-Z][a-zA-Z0-9]* { return new Token(Token.ID, yytext(), yyline+1, yycolumn+1); } - -0 { return new IntConstToken(Token.INTCONST, yytext(), yyline+1, yycolumn+1, 0); } -0/\. { yybegin(INT); textvalue=yytext(); startline=yyline+1; startcolumn=yycolumn+1; - intvalue=yytext().charAt(0)-'0'; fracvalue=0; fraclength=0; expvalue=0; } -[1-9] { yybegin(INT); textvalue=yytext(); startline=yyline+1; startcolumn=yycolumn+1; - intvalue=yytext().charAt(0)-'0'; fracvalue=0; fraclength=0; expvalue=0; } - -\" { yybegin(STRING); textvalue="\""; stringvalue=""; startline=yyline+1; startcolumn=yycolumn+1; } - -(\/\*)~(\*\/) { /* eat comments */ } -[\ \t\b\f\r\n]+ { /* eat whitespace */ } -<> { return new Token(Token.EOF, yytext(), yyline+1, yycolumn+1); } -[^] { return new Token(Token.INVALID, yytext(), yyline+1, yycolumn+1); } - - { - [a-zA-Z \.:] { textvalue+=yytext(); stringvalue+=yytext(); } - \\\" { textvalue+="\\\""; stringvalue+="\""; } - \" { yybegin(YYINITIAL); return new StringConstToken(Token.STRINGCONST, textvalue+"\"", startline, startcolumn, stringvalue); } - [^] { yybegin(YYINITIAL); return new Token(Token.INVALID, textvalue+yytext(), startline, startcolumn); } - <> { yybegin(YYINITIAL); return new Token(Token.INVALID, textvalue, startline, startcolumn); } -} - - { - [0-9] { intvalue = 10*intvalue + yytext().charAt(0)-'0'; - textvalue+=yytext();} - \. { yybegin(FRACTION); - textvalue+=yytext();} - [eE]/-?[0-9] { yybegin(EXPVZ); textvalue += yytext(); } - [^] { yybegin(YYINITIAL); - yypushback(1); - return new IntConstToken(Token.INTCONST, textvalue, startline, startcolumn, intvalue); } - <> { yybegin(YYINITIAL); - yypushback(1); - return new IntConstToken(Token.INTCONST, textvalue, startline, startcolumn, intvalue);} -} - - { - [0-9] { fracvalue= 10*fracvalue+ yytext().charAt(0)-'0'; - fraclength++; - textvalue+=yytext();} - [eE]/-?[0-9] { yybegin(EXPVZ); - textvalue+=yytext();} - [^] { yybegin(YYINITIAL); - yypushback(1); - return new FloatConstToken(Token.FLOATCONST, textvalue, startline, startcolumn,intvalue+fracvalue/Math.pow(10,fraclength)); } - <> { yybegin(YYINITIAL); - yypushback(1); - return new FloatConstToken(Token.FLOATCONST, textvalue, startline, startcolumn,intvalue+fracvalue/Math.pow(10,fraclength)); } -} - - { - -0|0 { yybegin(YYINITIAL); - return new FloatConstToken(Token.FLOATCONST, textvalue+yytext(), startline, startcolumn,intvalue+fracvalue/Math.pow(10,fraclength)); } - -[1-9] { yybegin(EXP); expvalue=yytext().charAt(1)-'0'; expsign=-1; textvalue+=yytext(); } - [1-9] { yybegin(EXP); expvalue=yytext().charAt(0)-'0'; expsign=1; textvalue+=yytext(); } - [^] { yybegin(YYINITIAL); - yypushback(1); - return new Token(Token.INVALID, textvalue, startline, startcolumn); } - <> { yybegin(YYINITIAL); - yypushback(1); - return new Token(Token.INVALID, textvalue, startline, startcolumn); } -} - - { - [0-9] { expvalue = 10* expvalue + yytext().charAt(0)-'0'; textvalue+=yytext(); } - [^] { yybegin(YYINITIAL); - yypushback(1); - return new FloatConstToken(Token.FLOATCONST, textvalue, startline, startcolumn, (intvalue+fracvalue/Math.pow(10,fraclength))*Math.pow(10,expvalue*expsign)); } - <> { yybegin(YYINITIAL); - yypushback(1); - return new FloatConstToken(Token.FLOATCONST, textvalue, startline, startcolumn, (intvalue+fracvalue/Math.pow(10,fraclength))*Math.pow(10,expvalue*expsign)); } -} -