// Generated from Basic.g4 by ANTLR 4.7
package pp.s1184725.boppi;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class BasicParser extends Parser {
	static { RuntimeMetaData.checkVersion("4.7", RuntimeMetaData.VERSION); }

	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		PAROPEN=1, PARCLOSE=2, BRAOPEN=3, BRACLOSE=4, IN=5, OUT=6, IFOPEN=7, IFTRUE=8, 
		IFFALSE=9, IFCLOSE=10, WHILEOPEN=11, WHILETRUE=12, WHILECLOSE=13, PLUS=14, 
		MINUS=15, NOT=16, MULTIPLY=17, DIVIDE=18, MODULO=19, LEQ=20, GTE=21, NEQ=22, 
		EQ=23, LT=24, GT=25, AND=26, OR=27, DECLARE=28, INTTYPE=29, BOOLTYPE=30, 
		CHARTYPE=31, ASSIGN=32, COMPOUND=33, LISTDELIM=34, CHAR=35, TRUE=36, FALSE=37, 
		IDENTIFIER=38, LITERAL10=39, WHITESPACE=40, LINECOMMENT=41, BLOCKCOMMENT=42;
	public static final int
		RULE_program = 0, RULE_expr = 1, RULE_singleExpr = 2, RULE_type = 3, RULE_variable = 4;
	public static final String[] ruleNames = {
		"program", "expr", "singleExpr", "type", "variable"
	};

	private static final String[] _LITERAL_NAMES = {
		null, "'('", "')'", "'{'", "'}'", "'read'", "'print'", "'if'", "'then'", 
		"'else'", "'fi'", "'while'", "'do'", "'od'", "'+'", "'-'", "'!'", "'*'", 
		"'/'", "'%'", "'<='", "'>='", "'<>'", "'=='", "'<'", "'>'", "'&&'", "'||'", 
		"'var'", "'int'", "'bool'", "'char'", "':='", "';'", "','", null, "'true'", 
		"'false'"
	};
	private static final String[] _SYMBOLIC_NAMES = {
		null, "PAROPEN", "PARCLOSE", "BRAOPEN", "BRACLOSE", "IN", "OUT", "IFOPEN", 
		"IFTRUE", "IFFALSE", "IFCLOSE", "WHILEOPEN", "WHILETRUE", "WHILECLOSE", 
		"PLUS", "MINUS", "NOT", "MULTIPLY", "DIVIDE", "MODULO", "LEQ", "GTE", 
		"NEQ", "EQ", "LT", "GT", "AND", "OR", "DECLARE", "INTTYPE", "BOOLTYPE", 
		"CHARTYPE", "ASSIGN", "COMPOUND", "LISTDELIM", "CHAR", "TRUE", "FALSE", 
		"IDENTIFIER", "LITERAL10", "WHITESPACE", "LINECOMMENT", "BLOCKCOMMENT"
	};
	public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);

	/**
	 * @deprecated Use {@link #VOCABULARY} instead.
	 */
	@Deprecated
	public static final String[] tokenNames;
	static {
		tokenNames = new String[_SYMBOLIC_NAMES.length];
		for (int i = 0; i < tokenNames.length; i++) {
			tokenNames[i] = VOCABULARY.getLiteralName(i);
			if (tokenNames[i] == null) {
				tokenNames[i] = VOCABULARY.getSymbolicName(i);
			}

			if (tokenNames[i] == null) {
				tokenNames[i] = "<INVALID>";
			}
		}
	}

	@Override
	@Deprecated
	public String[] getTokenNames() {
		return tokenNames;
	}

	@Override

	public Vocabulary getVocabulary() {
		return VOCABULARY;
	}

	@Override
	public String getGrammarFileName() { return "Basic.g4"; }

	@Override
	public String[] getRuleNames() { return ruleNames; }

	@Override
	public String getSerializedATN() { return _serializedATN; }

	@Override
	public ATN getATN() { return _ATN; }

	public BasicParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class ProgramContext extends ParserRuleContext {
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public TerminalNode EOF() { return getToken(BasicParser.EOF, 0); }
		public ProgramContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_program; }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitProgram(this);
			else return visitor.visitChildren(this);
		}
	}

	public final ProgramContext program() throws RecognitionException {
		ProgramContext _localctx = new ProgramContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_program);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(10);
			expr();
			setState(11);
			match(EOF);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ExprContext extends ParserRuleContext {
		public List<SingleExprContext> singleExpr() {
			return getRuleContexts(SingleExprContext.class);
		}
		public SingleExprContext singleExpr(int i) {
			return getRuleContext(SingleExprContext.class,i);
		}
		public List<TerminalNode> COMPOUND() { return getTokens(BasicParser.COMPOUND); }
		public TerminalNode COMPOUND(int i) {
			return getToken(BasicParser.COMPOUND, i);
		}
		public ExprContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_expr; }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitExpr(this);
			else return visitor.visitChildren(this);
		}
	}

	public final ExprContext expr() throws RecognitionException {
		ExprContext _localctx = new ExprContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_expr);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(13);
			singleExpr(0);
			setState(20);
			_errHandler.sync(this);
			_la = _input.LA(1);
			while (_la==COMPOUND) {
				{
				{
				setState(14);
				match(COMPOUND);
				setState(16);
				_errHandler.sync(this);
				_la = _input.LA(1);
				if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << PAROPEN) | (1L << BRAOPEN) | (1L << IN) | (1L << OUT) | (1L << IFOPEN) | (1L << WHILEOPEN) | (1L << PLUS) | (1L << MINUS) | (1L << NOT) | (1L << DECLARE) | (1L << CHAR) | (1L << TRUE) | (1L << FALSE) | (1L << IDENTIFIER) | (1L << LITERAL10))) != 0)) {
					{
					setState(15);
					singleExpr(0);
					}
				}

				}
				}
				setState(22);
				_errHandler.sync(this);
				_la = _input.LA(1);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class SingleExprContext extends ParserRuleContext {
		public SingleExprContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_singleExpr; }
	 
		public SingleExprContext() { }
		public void copyFrom(SingleExprContext ctx) {
			super.copyFrom(ctx);
		}
	}
	public static class ParensContext extends SingleExprContext {
		public TerminalNode PAROPEN() { return getToken(BasicParser.PAROPEN, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public TerminalNode PARCLOSE() { return getToken(BasicParser.PARCLOSE, 0); }
		public ParensContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitParens(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class ReadContext extends SingleExprContext {
		public TerminalNode IN() { return getToken(BasicParser.IN, 0); }
		public TerminalNode PAROPEN() { return getToken(BasicParser.PAROPEN, 0); }
		public List<VariableContext> variable() {
			return getRuleContexts(VariableContext.class);
		}
		public VariableContext variable(int i) {
			return getRuleContext(VariableContext.class,i);
		}
		public TerminalNode PARCLOSE() { return getToken(BasicParser.PARCLOSE, 0); }
		public List<TerminalNode> LISTDELIM() { return getTokens(BasicParser.LISTDELIM); }
		public TerminalNode LISTDELIM(int i) {
			return getToken(BasicParser.LISTDELIM, i);
		}
		public ReadContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitRead(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class DeclareContext extends SingleExprContext {
		public TerminalNode DECLARE() { return getToken(BasicParser.DECLARE, 0); }
		public TypeContext type() {
			return getRuleContext(TypeContext.class,0);
		}
		public TerminalNode IDENTIFIER() { return getToken(BasicParser.IDENTIFIER, 0); }
		public DeclareContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitDeclare(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class BoolContext extends SingleExprContext {
		public TerminalNode TRUE() { return getToken(BasicParser.TRUE, 0); }
		public TerminalNode FALSE() { return getToken(BasicParser.FALSE, 0); }
		public BoolContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitBool(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class VarContext extends SingleExprContext {
		public VariableContext variable() {
			return getRuleContext(VariableContext.class,0);
		}
		public VarContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitVar(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class Infix2Context extends SingleExprContext {
		public SingleExprContext lhs;
		public Token op;
		public SingleExprContext rhs;
		public List<SingleExprContext> singleExpr() {
			return getRuleContexts(SingleExprContext.class);
		}
		public SingleExprContext singleExpr(int i) {
			return getRuleContext(SingleExprContext.class,i);
		}
		public TerminalNode PLUS() { return getToken(BasicParser.PLUS, 0); }
		public TerminalNode MINUS() { return getToken(BasicParser.MINUS, 0); }
		public Infix2Context(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitInfix2(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class Infix3Context extends SingleExprContext {
		public SingleExprContext lhs;
		public Token op;
		public SingleExprContext rhs;
		public List<SingleExprContext> singleExpr() {
			return getRuleContexts(SingleExprContext.class);
		}
		public SingleExprContext singleExpr(int i) {
			return getRuleContext(SingleExprContext.class,i);
		}
		public TerminalNode LT() { return getToken(BasicParser.LT, 0); }
		public TerminalNode LEQ() { return getToken(BasicParser.LEQ, 0); }
		public TerminalNode GTE() { return getToken(BasicParser.GTE, 0); }
		public TerminalNode GT() { return getToken(BasicParser.GT, 0); }
		public TerminalNode EQ() { return getToken(BasicParser.EQ, 0); }
		public TerminalNode NEQ() { return getToken(BasicParser.NEQ, 0); }
		public Infix3Context(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitInfix3(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class Infix1Context extends SingleExprContext {
		public SingleExprContext lhs;
		public Token op;
		public SingleExprContext rhs;
		public List<SingleExprContext> singleExpr() {
			return getRuleContexts(SingleExprContext.class);
		}
		public SingleExprContext singleExpr(int i) {
			return getRuleContext(SingleExprContext.class,i);
		}
		public TerminalNode MULTIPLY() { return getToken(BasicParser.MULTIPLY, 0); }
		public TerminalNode DIVIDE() { return getToken(BasicParser.DIVIDE, 0); }
		public TerminalNode MODULO() { return getToken(BasicParser.MODULO, 0); }
		public Infix1Context(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitInfix1(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class WhileContext extends SingleExprContext {
		public ExprContext cond;
		public ExprContext onTrue;
		public TerminalNode WHILEOPEN() { return getToken(BasicParser.WHILEOPEN, 0); }
		public TerminalNode WHILETRUE() { return getToken(BasicParser.WHILETRUE, 0); }
		public TerminalNode WHILECLOSE() { return getToken(BasicParser.WHILECLOSE, 0); }
		public List<ExprContext> expr() {
			return getRuleContexts(ExprContext.class);
		}
		public ExprContext expr(int i) {
			return getRuleContext(ExprContext.class,i);
		}
		public WhileContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitWhile(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class Infix4Context extends SingleExprContext {
		public SingleExprContext lhs;
		public SingleExprContext rhs;
		public TerminalNode AND() { return getToken(BasicParser.AND, 0); }
		public List<SingleExprContext> singleExpr() {
			return getRuleContexts(SingleExprContext.class);
		}
		public SingleExprContext singleExpr(int i) {
			return getRuleContext(SingleExprContext.class,i);
		}
		public Infix4Context(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitInfix4(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class Infix5Context extends SingleExprContext {
		public SingleExprContext lhs;
		public SingleExprContext rhs;
		public TerminalNode OR() { return getToken(BasicParser.OR, 0); }
		public List<SingleExprContext> singleExpr() {
			return getRuleContexts(SingleExprContext.class);
		}
		public SingleExprContext singleExpr(int i) {
			return getRuleContext(SingleExprContext.class,i);
		}
		public Infix5Context(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitInfix5(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class NumberContext extends SingleExprContext {
		public TerminalNode LITERAL10() { return getToken(BasicParser.LITERAL10, 0); }
		public NumberContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitNumber(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class CharContext extends SingleExprContext {
		public TerminalNode CHAR() { return getToken(BasicParser.CHAR, 0); }
		public CharContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitChar(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class BlockContext extends SingleExprContext {
		public TerminalNode BRAOPEN() { return getToken(BasicParser.BRAOPEN, 0); }
		public ExprContext expr() {
			return getRuleContext(ExprContext.class,0);
		}
		public TerminalNode BRACLOSE() { return getToken(BasicParser.BRACLOSE, 0); }
		public BlockContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitBlock(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class WriteContext extends SingleExprContext {
		public TerminalNode OUT() { return getToken(BasicParser.OUT, 0); }
		public TerminalNode PAROPEN() { return getToken(BasicParser.PAROPEN, 0); }
		public List<ExprContext> expr() {
			return getRuleContexts(ExprContext.class);
		}
		public ExprContext expr(int i) {
			return getRuleContext(ExprContext.class,i);
		}
		public TerminalNode PARCLOSE() { return getToken(BasicParser.PARCLOSE, 0); }
		public List<TerminalNode> LISTDELIM() { return getTokens(BasicParser.LISTDELIM); }
		public TerminalNode LISTDELIM(int i) {
			return getToken(BasicParser.LISTDELIM, i);
		}
		public WriteContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitWrite(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class IfContext extends SingleExprContext {
		public ExprContext cond;
		public ExprContext onTrue;
		public ExprContext onFalse;
		public TerminalNode IFOPEN() { return getToken(BasicParser.IFOPEN, 0); }
		public TerminalNode IFTRUE() { return getToken(BasicParser.IFTRUE, 0); }
		public TerminalNode IFCLOSE() { return getToken(BasicParser.IFCLOSE, 0); }
		public List<ExprContext> expr() {
			return getRuleContexts(ExprContext.class);
		}
		public ExprContext expr(int i) {
			return getRuleContext(ExprContext.class,i);
		}
		public TerminalNode IFFALSE() { return getToken(BasicParser.IFFALSE, 0); }
		public IfContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitIf(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class Prefix1Context extends SingleExprContext {
		public Token op;
		public SingleExprContext singleExpr() {
			return getRuleContext(SingleExprContext.class,0);
		}
		public TerminalNode PLUS() { return getToken(BasicParser.PLUS, 0); }
		public TerminalNode MINUS() { return getToken(BasicParser.MINUS, 0); }
		public TerminalNode NOT() { return getToken(BasicParser.NOT, 0); }
		public Prefix1Context(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitPrefix1(this);
			else return visitor.visitChildren(this);
		}
	}
	public static class AssignContext extends SingleExprContext {
		public VariableContext variable() {
			return getRuleContext(VariableContext.class,0);
		}
		public TerminalNode ASSIGN() { return getToken(BasicParser.ASSIGN, 0); }
		public SingleExprContext singleExpr() {
			return getRuleContext(SingleExprContext.class,0);
		}
		public AssignContext(SingleExprContext ctx) { copyFrom(ctx); }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitAssign(this);
			else return visitor.visitChildren(this);
		}
	}

	public final SingleExprContext singleExpr() throws RecognitionException {
		return singleExpr(0);
	}

	private SingleExprContext singleExpr(int _p) throws RecognitionException {
		ParserRuleContext _parentctx = _ctx;
		int _parentState = getState();
		SingleExprContext _localctx = new SingleExprContext(_ctx, _parentState);
		SingleExprContext _prevctx = _localctx;
		int _startState = 4;
		enterRecursionRule(_localctx, 4, RULE_singleExpr, _p);
		int _la;
		try {
			int _alt;
			enterOuterAlt(_localctx, 1);
			{
			setState(86);
			_errHandler.sync(this);
			switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
			case 1:
				{
				_localctx = new ParensContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;

				setState(24);
				match(PAROPEN);
				setState(25);
				expr();
				setState(26);
				match(PARCLOSE);
				}
				break;
			case 2:
				{
				_localctx = new BlockContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(28);
				match(BRAOPEN);
				setState(29);
				expr();
				setState(30);
				match(BRACLOSE);
				}
				break;
			case 3:
				{
				_localctx = new ReadContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(32);
				match(IN);
				setState(33);
				match(PAROPEN);
				setState(34);
				variable();
				setState(39);
				_errHandler.sync(this);
				_la = _input.LA(1);
				while (_la==LISTDELIM) {
					{
					{
					setState(35);
					match(LISTDELIM);
					setState(36);
					variable();
					}
					}
					setState(41);
					_errHandler.sync(this);
					_la = _input.LA(1);
				}
				setState(42);
				match(PARCLOSE);
				}
				break;
			case 4:
				{
				_localctx = new WriteContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(44);
				match(OUT);
				setState(45);
				match(PAROPEN);
				setState(46);
				expr();
				setState(51);
				_errHandler.sync(this);
				_la = _input.LA(1);
				while (_la==LISTDELIM) {
					{
					{
					setState(47);
					match(LISTDELIM);
					setState(48);
					expr();
					}
					}
					setState(53);
					_errHandler.sync(this);
					_la = _input.LA(1);
				}
				setState(54);
				match(PARCLOSE);
				}
				break;
			case 5:
				{
				_localctx = new IfContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(56);
				match(IFOPEN);
				setState(57);
				((IfContext)_localctx).cond = expr();
				setState(58);
				match(IFTRUE);
				setState(59);
				((IfContext)_localctx).onTrue = expr();
				setState(62);
				_errHandler.sync(this);
				_la = _input.LA(1);
				if (_la==IFFALSE) {
					{
					setState(60);
					match(IFFALSE);
					setState(61);
					((IfContext)_localctx).onFalse = expr();
					}
				}

				setState(64);
				match(IFCLOSE);
				}
				break;
			case 6:
				{
				_localctx = new WhileContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(66);
				match(WHILEOPEN);
				setState(67);
				((WhileContext)_localctx).cond = expr();
				setState(68);
				match(WHILETRUE);
				setState(69);
				((WhileContext)_localctx).onTrue = expr();
				setState(70);
				match(WHILECLOSE);
				}
				break;
			case 7:
				{
				_localctx = new Prefix1Context(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(72);
				((Prefix1Context)_localctx).op = _input.LT(1);
				_la = _input.LA(1);
				if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << PLUS) | (1L << MINUS) | (1L << NOT))) != 0)) ) {
					((Prefix1Context)_localctx).op = (Token)_errHandler.recoverInline(this);
				}
				else {
					if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
					_errHandler.reportMatch(this);
					consume();
				}
				setState(73);
				singleExpr(12);
				}
				break;
			case 8:
				{
				_localctx = new DeclareContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(74);
				match(DECLARE);
				setState(75);
				type();
				setState(76);
				match(IDENTIFIER);
				}
				break;
			case 9:
				{
				_localctx = new AssignContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(78);
				variable();
				setState(79);
				match(ASSIGN);
				setState(80);
				singleExpr(5);
				}
				break;
			case 10:
				{
				_localctx = new VarContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(82);
				variable();
				}
				break;
			case 11:
				{
				_localctx = new NumberContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(83);
				match(LITERAL10);
				}
				break;
			case 12:
				{
				_localctx = new CharContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(84);
				match(CHAR);
				}
				break;
			case 13:
				{
				_localctx = new BoolContext(_localctx);
				_ctx = _localctx;
				_prevctx = _localctx;
				setState(85);
				_la = _input.LA(1);
				if ( !(_la==TRUE || _la==FALSE) ) {
				_errHandler.recoverInline(this);
				}
				else {
					if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
					_errHandler.reportMatch(this);
					consume();
				}
				}
				break;
			}
			_ctx.stop = _input.LT(-1);
			setState(105);
			_errHandler.sync(this);
			_alt = getInterpreter().adaptivePredict(_input,7,_ctx);
			while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
				if ( _alt==1 ) {
					if ( _parseListeners!=null ) triggerExitRuleEvent();
					_prevctx = _localctx;
					{
					setState(103);
					_errHandler.sync(this);
					switch ( getInterpreter().adaptivePredict(_input,6,_ctx) ) {
					case 1:
						{
						_localctx = new Infix1Context(new SingleExprContext(_parentctx, _parentState));
						((Infix1Context)_localctx).lhs = _prevctx;
						pushNewRecursionContext(_localctx, _startState, RULE_singleExpr);
						setState(88);
						if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)");
						setState(89);
						((Infix1Context)_localctx).op = _input.LT(1);
						_la = _input.LA(1);
						if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MULTIPLY) | (1L << DIVIDE) | (1L << MODULO))) != 0)) ) {
							((Infix1Context)_localctx).op = (Token)_errHandler.recoverInline(this);
						}
						else {
							if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
							_errHandler.reportMatch(this);
							consume();
						}
						setState(90);
						((Infix1Context)_localctx).rhs = singleExpr(12);
						}
						break;
					case 2:
						{
						_localctx = new Infix2Context(new SingleExprContext(_parentctx, _parentState));
						((Infix2Context)_localctx).lhs = _prevctx;
						pushNewRecursionContext(_localctx, _startState, RULE_singleExpr);
						setState(91);
						if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)");
						setState(92);
						((Infix2Context)_localctx).op = _input.LT(1);
						_la = _input.LA(1);
						if ( !(_la==PLUS || _la==MINUS) ) {
							((Infix2Context)_localctx).op = (Token)_errHandler.recoverInline(this);
						}
						else {
							if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
							_errHandler.reportMatch(this);
							consume();
						}
						setState(93);
						((Infix2Context)_localctx).rhs = singleExpr(11);
						}
						break;
					case 3:
						{
						_localctx = new Infix3Context(new SingleExprContext(_parentctx, _parentState));
						((Infix3Context)_localctx).lhs = _prevctx;
						pushNewRecursionContext(_localctx, _startState, RULE_singleExpr);
						setState(94);
						if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)");
						setState(95);
						((Infix3Context)_localctx).op = _input.LT(1);
						_la = _input.LA(1);
						if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << LEQ) | (1L << GTE) | (1L << NEQ) | (1L << EQ) | (1L << LT) | (1L << GT))) != 0)) ) {
							((Infix3Context)_localctx).op = (Token)_errHandler.recoverInline(this);
						}
						else {
							if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
							_errHandler.reportMatch(this);
							consume();
						}
						setState(96);
						((Infix3Context)_localctx).rhs = singleExpr(10);
						}
						break;
					case 4:
						{
						_localctx = new Infix4Context(new SingleExprContext(_parentctx, _parentState));
						((Infix4Context)_localctx).lhs = _prevctx;
						pushNewRecursionContext(_localctx, _startState, RULE_singleExpr);
						setState(97);
						if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)");
						setState(98);
						match(AND);
						setState(99);
						((Infix4Context)_localctx).rhs = singleExpr(9);
						}
						break;
					case 5:
						{
						_localctx = new Infix5Context(new SingleExprContext(_parentctx, _parentState));
						((Infix5Context)_localctx).lhs = _prevctx;
						pushNewRecursionContext(_localctx, _startState, RULE_singleExpr);
						setState(100);
						if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)");
						setState(101);
						match(OR);
						setState(102);
						((Infix5Context)_localctx).rhs = singleExpr(8);
						}
						break;
					}
					} 
				}
				setState(107);
				_errHandler.sync(this);
				_alt = getInterpreter().adaptivePredict(_input,7,_ctx);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			unrollRecursionContexts(_parentctx);
		}
		return _localctx;
	}

	public static class TypeContext extends ParserRuleContext {
		public Token staticType;
		public TerminalNode INTTYPE() { return getToken(BasicParser.INTTYPE, 0); }
		public TerminalNode BOOLTYPE() { return getToken(BasicParser.BOOLTYPE, 0); }
		public TerminalNode CHARTYPE() { return getToken(BasicParser.CHARTYPE, 0); }
		public VariableContext variable() {
			return getRuleContext(VariableContext.class,0);
		}
		public TypeContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_type; }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitType(this);
			else return visitor.visitChildren(this);
		}
	}

	public final TypeContext type() throws RecognitionException {
		TypeContext _localctx = new TypeContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_type);
		int _la;
		try {
			setState(110);
			_errHandler.sync(this);
			switch (_input.LA(1)) {
			case INTTYPE:
			case BOOLTYPE:
			case CHARTYPE:
				enterOuterAlt(_localctx, 1);
				{
				setState(108);
				((TypeContext)_localctx).staticType = _input.LT(1);
				_la = _input.LA(1);
				if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INTTYPE) | (1L << BOOLTYPE) | (1L << CHARTYPE))) != 0)) ) {
					((TypeContext)_localctx).staticType = (Token)_errHandler.recoverInline(this);
				}
				else {
					if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
					_errHandler.reportMatch(this);
					consume();
				}
				}
				break;
			case IDENTIFIER:
				enterOuterAlt(_localctx, 2);
				{
				setState(109);
				variable();
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class VariableContext extends ParserRuleContext {
		public TerminalNode IDENTIFIER() { return getToken(BasicParser.IDENTIFIER, 0); }
		public VariableContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_variable; }
		@Override
		public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
			if ( visitor instanceof BasicVisitor ) return ((BasicVisitor<? extends T>)visitor).visitVariable(this);
			else return visitor.visitChildren(this);
		}
	}

	public final VariableContext variable() throws RecognitionException {
		VariableContext _localctx = new VariableContext(_ctx, getState());
		enterRule(_localctx, 8, RULE_variable);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(112);
			match(IDENTIFIER);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
		switch (ruleIndex) {
		case 2:
			return singleExpr_sempred((SingleExprContext)_localctx, predIndex);
		}
		return true;
	}
	private boolean singleExpr_sempred(SingleExprContext _localctx, int predIndex) {
		switch (predIndex) {
		case 0:
			return precpred(_ctx, 11);
		case 1:
			return precpred(_ctx, 10);
		case 2:
			return precpred(_ctx, 9);
		case 3:
			return precpred(_ctx, 8);
		case 4:
			return precpred(_ctx, 7);
		}
		return true;
	}

	public static final String _serializedATN =
		"\3\u608b\ua72a\u8133\ub9ed\u417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\5\n\6\2pn\3\2\2\2po\3\2\2\2q\t\3\2\2\2rs\7(\2\2s\13\3\2\2\2"+
		"\13\22\26)\65@Xikp";
	public static final ATN _ATN =
		new ATNDeserializer().deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
		}
	}
}