// $ANTLR : "dspl.g" -> "DSPLParser.java"$
 package dspl.frontend; import antlr.*;
import antlr.TokenBuffer;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.ANTLRException;
import antlr.LLkParser;
import antlr.Token;
import antlr.TokenStream;
import antlr.RecognitionException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.ParserSharedInputState;
import antlr.collections.impl.BitSet;
import antlr.collections.AST;
import java.util.Hashtable;
import antlr.ASTFactory;
import antlr.ASTPair;
import antlr.collections.impl.ASTArray;

public class DSPLParser extends antlr.LLkParser       implements ParserTokensTokenTypes
 {

	public void reportError(antlr.RecognitionException e) {
		System.err.println(e.toString());
		System.exit(2);
	}

protected DSPLParser(TokenBuffer tokenBuf, int k) {
  super(tokenBuf,k);
  tokenNames = _tokenNames;
  buildTokenTypeASTClassMap();
  astFactory = new ASTFactory(getTokenTypeToASTClassMap());
}

public DSPLParser(TokenBuffer tokenBuf) {
  this(tokenBuf,2);
}

protected DSPLParser(TokenStream lexer, int k) {
  super(lexer,k);
  tokenNames = _tokenNames;
  buildTokenTypeASTClassMap();
  astFactory = new ASTFactory(getTokenTypeToASTClassMap());
}

public DSPLParser(TokenStream lexer) {
  this(lexer,2);
}

public DSPLParser(ParserSharedInputState state) {
  super(state,2);
  tokenNames = _tokenNames;
  buildTokenTypeASTClassMap();
  astFactory = new ASTFactory(getTokenTypeToASTClassMap());
}

	public final void program() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST program_AST = null;
		
		try {      // for error handling
			{
			if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2)))) {
				decls();
				astFactory.addASTChild(currentAST, returnAST);
			}
			else if ((_tokenSet_2.member(LA(1))) && (_tokenSet_1.member(LA(2)))) {
			}
			else {
				throw new NoViableAltException(LT(1), getFilename());
			}
			
			}
			{
			_loop219:
			do {
				if ((_tokenSet_3.member(LA(1)))) {
					stmt();
					astFactory.addASTChild(currentAST, returnAST);
				}
				else {
					break _loop219;
				}
				
			} while (true);
			}
			program_AST = (AST)currentAST.root;
			program_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(PROGRAM,"PROGRAM")).add(program_AST));
			currentAST.root = program_AST;
			currentAST.child = program_AST!=null &&program_AST.getFirstChild()!=null ?
				program_AST.getFirstChild() : program_AST;
			currentAST.advanceChildToEnd();
			program_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_4);
		}
		returnAST = program_AST;
	}
	
	public final void decls() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST decls_AST = null;
		
		try {      // for error handling
			{
			_loop225:
			do {
				if ((_tokenSet_5.member(LA(1)))) {
					decl();
					astFactory.addASTChild(currentAST, returnAST);
				}
				else {
					break _loop225;
				}
				
			} while (true);
			}
			decls_AST = (AST)currentAST.root;
			
							decls_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(DECLS,"DECLS")).add(decls_AST));
							
			currentAST.root = decls_AST;
			currentAST.child = decls_AST!=null &&decls_AST.getFirstChild()!=null ?
				decls_AST.getFirstChild() : decls_AST;
			currentAST.advanceChildToEnd();
			decls_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_2);
		}
		returnAST = decls_AST;
	}
	
	public final void stmt() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST stmt_AST = null;
		
		try {      // for error handling
			switch ( LA(1)) {
			case ID:
			{
				assignment();
				astFactory.addASTChild(currentAST, returnAST);
				match(SEMI);
				stmt_AST = (AST)currentAST.root;
				break;
			}
			case LITERAL_if:
			{
				AST tmp2_AST = null;
				tmp2_AST = astFactory.create(LT(1));
				astFactory.makeASTRoot(currentAST, tmp2_AST);
				match(LITERAL_if);
				match(LPAREN);
				bool();
				astFactory.addASTChild(currentAST, returnAST);
				match(RPAREN);
				subprogram();
				astFactory.addASTChild(currentAST, returnAST);
				{
				switch ( LA(1)) {
				case LITERAL_else:
				{
					match(LITERAL_else);
					subprogram();
					astFactory.addASTChild(currentAST, returnAST);
					break;
				}
				case EOF:
				case RBRACE:
				case ID:
				case SEMI:
				case LITERAL_if:
				case LITERAL_while:
				case LITERAL_for:
				case LITERAL_ccall:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				stmt_AST = (AST)currentAST.root;
				break;
			}
			case LITERAL_while:
			{
				AST tmp6_AST = null;
				tmp6_AST = astFactory.create(LT(1));
				astFactory.makeASTRoot(currentAST, tmp6_AST);
				match(LITERAL_while);
				match(LPAREN);
				bool();
				astFactory.addASTChild(currentAST, returnAST);
				match(RPAREN);
				subprogram();
				astFactory.addASTChild(currentAST, returnAST);
				stmt_AST = (AST)currentAST.root;
				break;
			}
			case LITERAL_for:
			{
				AST tmp9_AST = null;
				tmp9_AST = astFactory.create(LT(1));
				astFactory.makeASTRoot(currentAST, tmp9_AST);
				match(LITERAL_for);
				match(LPAREN);
				{
				switch ( LA(1)) {
				case ID:
				{
					assignment();
					astFactory.addASTChild(currentAST, returnAST);
					{
					_loop235:
					do {
						if ((LA(1)==COMMA)) {
							match(COMMA);
							assignment();
							astFactory.addASTChild(currentAST, returnAST);
						}
						else {
							break _loop235;
						}
						
					} while (true);
					}
					break;
				}
				case SEMI:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				match(SEMI);
				bool();
				astFactory.addASTChild(currentAST, returnAST);
				match(SEMI);
				{
				switch ( LA(1)) {
				case ID:
				{
					assignment();
					astFactory.addASTChild(currentAST, returnAST);
					{
					_loop238:
					do {
						if ((LA(1)==COMMA)) {
							match(COMMA);
							assignment();
							astFactory.addASTChild(currentAST, returnAST);
						}
						else {
							break _loop238;
						}
						
					} while (true);
					}
					break;
				}
				case RPAREN:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				match(RPAREN);
				subprogram();
				astFactory.addASTChild(currentAST, returnAST);
				stmt_AST = (AST)currentAST.root;
				break;
			}
			case LITERAL_ccall:
			{
				ccall();
				astFactory.addASTChild(currentAST, returnAST);
				stmt_AST = (AST)currentAST.root;
				break;
			}
			case SEMI:
			{
				match(SEMI);
				stmt_AST = (AST)currentAST.root;
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_6);
		}
		returnAST = stmt_AST;
	}
	
	public final void subprogram() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST subprogram_AST = null;
		
		try {      // for error handling
			AST tmp17_AST = null;
			tmp17_AST = astFactory.create(LT(1));
			astFactory.makeASTRoot(currentAST, tmp17_AST);
			match(LBRACE);
			{
			_loop222:
			do {
				if ((_tokenSet_3.member(LA(1)))) {
					stmt();
					astFactory.addASTChild(currentAST, returnAST);
				}
				else {
					break _loop222;
				}
				
			} while (true);
			}
			match(RBRACE);
			subprogram_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_7);
		}
		returnAST = subprogram_AST;
	}
	
/** Variable declarations are allowed with names like:
	char foo;
	complex d;
	complex_array[10] fo_o;
	int_array[3] someArray3;
*/
	public final void decl() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST decl_AST = null;
		
		try {      // for error handling
			{
			switch ( LA(1)) {
			case LITERAL_string:
			case LITERAL_int:
			case LITERAL_uint:
			case LITERAL_byte:
			case LITERAL_ubyte:
			case LITERAL_float:
			case LITERAL_complex:
			{
				{
				switch ( LA(1)) {
				case LITERAL_string:
				{
					AST tmp19_AST = null;
					tmp19_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp19_AST);
					match(LITERAL_string);
					break;
				}
				case LITERAL_int:
				{
					AST tmp20_AST = null;
					tmp20_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp20_AST);
					match(LITERAL_int);
					break;
				}
				case LITERAL_uint:
				{
					AST tmp21_AST = null;
					tmp21_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp21_AST);
					match(LITERAL_uint);
					break;
				}
				case LITERAL_byte:
				{
					AST tmp22_AST = null;
					tmp22_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp22_AST);
					match(LITERAL_byte);
					break;
				}
				case LITERAL_ubyte:
				{
					AST tmp23_AST = null;
					tmp23_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp23_AST);
					match(LITERAL_ubyte);
					break;
				}
				case LITERAL_float:
				{
					AST tmp24_AST = null;
					tmp24_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp24_AST);
					match(LITERAL_float);
					break;
				}
				case LITERAL_complex:
				{
					AST tmp25_AST = null;
					tmp25_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp25_AST);
					match(LITERAL_complex);
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				AST tmp26_AST = null;
				tmp26_AST = astFactory.create(LT(1));
				astFactory.makeASTRoot(currentAST, tmp26_AST);
				match(ID);
				match(SEMI);
				break;
			}
			case LITERAL_complex_array:
			case LITERAL_int_array:
			case LITERAL_uint_array:
			case LITERAL_byte_array:
			case LITERAL_ubyte_array:
			case LITERAL_float_array:
			{
				{
				switch ( LA(1)) {
				case LITERAL_complex_array:
				{
					AST tmp28_AST = null;
					tmp28_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp28_AST);
					match(LITERAL_complex_array);
					break;
				}
				case LITERAL_int_array:
				{
					AST tmp29_AST = null;
					tmp29_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp29_AST);
					match(LITERAL_int_array);
					break;
				}
				case LITERAL_uint_array:
				{
					AST tmp30_AST = null;
					tmp30_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp30_AST);
					match(LITERAL_uint_array);
					break;
				}
				case LITERAL_byte_array:
				{
					AST tmp31_AST = null;
					tmp31_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp31_AST);
					match(LITERAL_byte_array);
					break;
				}
				case LITERAL_ubyte_array:
				{
					AST tmp32_AST = null;
					tmp32_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp32_AST);
					match(LITERAL_ubyte_array);
					break;
				}
				case LITERAL_float_array:
				{
					AST tmp33_AST = null;
					tmp33_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp33_AST);
					match(LITERAL_float_array);
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				{
				match(LBRACK);
				AST tmp35_AST = null;
				tmp35_AST = astFactory.create(LT(1));
				astFactory.addASTChild(currentAST, tmp35_AST);
				match(NUM);
				match(RBRACK);
				}
				AST tmp37_AST = null;
				tmp37_AST = astFactory.create(LT(1));
				astFactory.makeASTRoot(currentAST, tmp37_AST);
				match(ID);
				match(SEMI);
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
			decl_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_0);
		}
		returnAST = decl_AST;
	}
	
	public final void assignment() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST assignment_AST = null;
		
		try {      // for error handling
			loc();
			astFactory.addASTChild(currentAST, returnAST);
			AST tmp39_AST = null;
			tmp39_AST = astFactory.create(LT(1));
			astFactory.makeASTRoot(currentAST, tmp39_AST);
			match(ASSIGN);
			expr();
			astFactory.addASTChild(currentAST, returnAST);
			assignment_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_8);
		}
		returnAST = assignment_AST;
	}
	
	public final void bool() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST bool_AST = null;
		
		try {      // for error handling
			unary();
			astFactory.addASTChild(currentAST, returnAST);
			{
			switch ( LA(1)) {
			case EQ:
			case NE:
			case LT:
			case LE:
			case GT:
			case GE:
			{
				{
				switch ( LA(1)) {
				case EQ:
				{
					AST tmp40_AST = null;
					tmp40_AST = astFactory.create(LT(1));
					astFactory.makeASTRoot(currentAST, tmp40_AST);
					match(EQ);
					break;
				}
				case NE:
				{
					AST tmp41_AST = null;
					tmp41_AST = astFactory.create(LT(1));
					astFactory.makeASTRoot(currentAST, tmp41_AST);
					match(NE);
					break;
				}
				case LT:
				{
					AST tmp42_AST = null;
					tmp42_AST = astFactory.create(LT(1));
					astFactory.makeASTRoot(currentAST, tmp42_AST);
					match(LT);
					break;
				}
				case LE:
				{
					AST tmp43_AST = null;
					tmp43_AST = astFactory.create(LT(1));
					astFactory.makeASTRoot(currentAST, tmp43_AST);
					match(LE);
					break;
				}
				case GT:
				{
					AST tmp44_AST = null;
					tmp44_AST = astFactory.create(LT(1));
					astFactory.makeASTRoot(currentAST, tmp44_AST);
					match(GT);
					break;
				}
				case GE:
				{
					AST tmp45_AST = null;
					tmp45_AST = astFactory.create(LT(1));
					astFactory.makeASTRoot(currentAST, tmp45_AST);
					match(GE);
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				unary();
				astFactory.addASTChild(currentAST, returnAST);
				break;
			}
			case SEMI:
			case RPAREN:
			{
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
			bool_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_9);
		}
		returnAST = bool_AST;
	}
	
	public final void ccall() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST ccall_AST = null;
		
		try {      // for error handling
			AST tmp46_AST = null;
			tmp46_AST = astFactory.create(LT(1));
			astFactory.makeASTRoot(currentAST, tmp46_AST);
			match(LITERAL_ccall);
			AST tmp47_AST = null;
			tmp47_AST = astFactory.create(LT(1));
			astFactory.addASTChild(currentAST, tmp47_AST);
			match(ID);
			match(LPAREN);
			{
			switch ( LA(1)) {
			case ID:
			case NUM:
			case PLUS:
			case MINUS:
			case REAL:
			case STRING:
			{
				unary();
				astFactory.addASTChild(currentAST, returnAST);
				{
				_loop242:
				do {
					if ((LA(1)==COMMA)) {
						match(COMMA);
						unary();
						astFactory.addASTChild(currentAST, returnAST);
					}
					else {
						break _loop242;
					}
					
				} while (true);
				}
				break;
			}
			case RPAREN:
			{
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
			match(RPAREN);
			match(SEMI);
			ccall_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_6);
		}
		returnAST = ccall_AST;
	}
	
	public final void unary() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST unary_AST = null;
		
		try {      // for error handling
			switch ( LA(1)) {
			case MINUS:
			{
				AST tmp52_AST = null;
				tmp52_AST = astFactory.create(LT(1));
				astFactory.makeASTRoot(currentAST, tmp52_AST);
				match(MINUS);
				{
				switch ( LA(1)) {
				case NUM:
				{
					AST tmp53_AST = null;
					tmp53_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp53_AST);
					match(NUM);
					break;
				}
				case REAL:
				{
					AST tmp54_AST = null;
					tmp54_AST = astFactory.create(LT(1));
					astFactory.addASTChild(currentAST, tmp54_AST);
					match(REAL);
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				}
				}
				unary_AST = (AST)currentAST.root;
				unary_AST.setType(NEGATE);
				unary_AST = (AST)currentAST.root;
				break;
			}
			case PLUS:
			{
				match(PLUS);
				unary();
				astFactory.addASTChild(currentAST, returnAST);
				unary_AST = (AST)currentAST.root;
				break;
			}
			case ID:
			case NUM:
			case REAL:
			case STRING:
			{
				factor();
				astFactory.addASTChild(currentAST, returnAST);
				unary_AST = (AST)currentAST.root;
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_10);
		}
		returnAST = unary_AST;
	}
	
	public final void loc() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST loc_AST = null;
		
		try {      // for error handling
			AST tmp56_AST = null;
			tmp56_AST = astFactory.create(LT(1));
			astFactory.makeASTRoot(currentAST, tmp56_AST);
			match(ID);
			{
			switch ( LA(1)) {
			case LBRACK:
			{
				AST tmp57_AST = null;
				tmp57_AST = astFactory.create(LT(1));
				astFactory.addASTChild(currentAST, tmp57_AST);
				match(LBRACK);
				expr();
				astFactory.addASTChild(currentAST, returnAST);
				AST tmp58_AST = null;
				tmp58_AST = astFactory.create(LT(1));
				astFactory.addASTChild(currentAST, tmp58_AST);
				match(RBRACK);
				break;
			}
			case SEMI:
			case RBRACK:
			case RPAREN:
			case COMMA:
			case ASSIGN:
			case EQ:
			case NE:
			case LT:
			case LE:
			case GT:
			case GE:
			case PLUS:
			case MINUS:
			case MUL:
			case DIV:
			{
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
			}
			loc_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_11);
		}
		returnAST = loc_AST;
	}
	
	public final void expr() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST expr_AST = null;
		
		try {      // for error handling
			term();
			astFactory.addASTChild(currentAST, returnAST);
			{
			_loop250:
			do {
				if ((LA(1)==PLUS||LA(1)==MINUS)) {
					{
					switch ( LA(1)) {
					case PLUS:
					{
						AST tmp59_AST = null;
						tmp59_AST = astFactory.create(LT(1));
						astFactory.makeASTRoot(currentAST, tmp59_AST);
						match(PLUS);
						break;
					}
					case MINUS:
					{
						AST tmp60_AST = null;
						tmp60_AST = astFactory.create(LT(1));
						astFactory.makeASTRoot(currentAST, tmp60_AST);
						match(MINUS);
						break;
					}
					default:
					{
						throw new NoViableAltException(LT(1), getFilename());
					}
					}
					}
					term();
					astFactory.addASTChild(currentAST, returnAST);
				}
				else {
					break _loop250;
				}
				
			} while (true);
			}
			expr_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_12);
		}
		returnAST = expr_AST;
	}
	
	public final void term() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST term_AST = null;
		
		try {      // for error handling
			paren();
			astFactory.addASTChild(currentAST, returnAST);
			{
			_loop254:
			do {
				if ((LA(1)==MUL||LA(1)==DIV)) {
					{
					switch ( LA(1)) {
					case MUL:
					{
						AST tmp61_AST = null;
						tmp61_AST = astFactory.create(LT(1));
						astFactory.makeASTRoot(currentAST, tmp61_AST);
						match(MUL);
						break;
					}
					case DIV:
					{
						AST tmp62_AST = null;
						tmp62_AST = astFactory.create(LT(1));
						astFactory.makeASTRoot(currentAST, tmp62_AST);
						match(DIV);
						break;
					}
					default:
					{
						throw new NoViableAltException(LT(1), getFilename());
					}
					}
					}
					paren();
					astFactory.addASTChild(currentAST, returnAST);
				}
				else {
					break _loop254;
				}
				
			} while (true);
			}
			term_AST = (AST)currentAST.root;
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_13);
		}
		returnAST = term_AST;
	}
	
	public final void paren() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST paren_AST = null;
		
		try {      // for error handling
			switch ( LA(1)) {
			case LPAREN:
			{
				{
				match(LPAREN);
				expr();
				astFactory.addASTChild(currentAST, returnAST);
				match(RPAREN);
				}
				paren_AST = (AST)currentAST.root;
				break;
			}
			case ID:
			case NUM:
			case PLUS:
			case MINUS:
			case REAL:
			case STRING:
			{
				unary();
				astFactory.addASTChild(currentAST, returnAST);
				paren_AST = (AST)currentAST.root;
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_14);
		}
		returnAST = paren_AST;
	}
	
	public final void factor() throws RecognitionException, TokenStreamException {
		
		returnAST = null;
		ASTPair currentAST = new ASTPair();
		AST factor_AST = null;
		
		try {      // for error handling
			switch ( LA(1)) {
			case ID:
			{
				loc();
				astFactory.addASTChild(currentAST, returnAST);
				factor_AST = (AST)currentAST.root;
				break;
			}
			case NUM:
			{
				AST tmp65_AST = null;
				tmp65_AST = astFactory.create(LT(1));
				astFactory.addASTChild(currentAST, tmp65_AST);
				match(NUM);
				factor_AST = (AST)currentAST.root;
				break;
			}
			case REAL:
			{
				AST tmp66_AST = null;
				tmp66_AST = astFactory.create(LT(1));
				astFactory.addASTChild(currentAST, tmp66_AST);
				match(REAL);
				factor_AST = (AST)currentAST.root;
				break;
			}
			case STRING:
			{
				AST tmp67_AST = null;
				tmp67_AST = astFactory.create(LT(1));
				astFactory.addASTChild(currentAST, tmp67_AST);
				match(STRING);
				factor_AST = (AST)currentAST.root;
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			recover(ex,_tokenSet_10);
		}
		returnAST = factor_AST;
	}
	
	
	public static final String[] _tokenNames = {
		"<0>",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"NEGATE",
		"DECLS",
		"PROGRAM",
		"LBRACE",
		"RBRACE",
		"\"string\"",
		"\"int\"",
		"\"uint\"",
		"\"byte\"",
		"\"ubyte\"",
		"\"float\"",
		"\"complex\"",
		"ID",
		"SEMI",
		"\"complex_array\"",
		"\"int_array\"",
		"\"uint_array\"",
		"\"byte_array\"",
		"\"ubyte_array\"",
		"\"float_array\"",
		"LBRACK",
		"NUM",
		"RBRACK",
		"\"if\"",
		"LPAREN",
		"RPAREN",
		"\"else\"",
		"\"while\"",
		"\"for\"",
		"COMMA",
		"\"ccall\"",
		"ASSIGN",
		"EQ",
		"NE",
		"LT",
		"LE",
		"GT",
		"GE",
		"PLUS",
		"MINUS",
		"MUL",
		"DIV",
		"REAL",
		"STRING",
		"NEWLINE",
		"DIGITS",
		"TILDE",
		"DOT",
		"WS",
		"COMMENT"
	};
	
	protected void buildTokenTypeASTClassMap() {
		tokenTypeToASTClassMap=null;
	};
	
	private static final long[] mk_tokenSet_0() {
		long[] data = { 23773314562L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
	private static final long[] mk_tokenSet_1() {
		long[] data = { 58401685506L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
	private static final long[] mk_tokenSet_2() {
		long[] data = { 23756734466L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
	private static final long[] mk_tokenSet_3() {
		long[] data = { 23756734464L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
	private static final long[] mk_tokenSet_4() {
		long[] data = { 2L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
	private static final long[] mk_tokenSet_5() {
		long[] data = { 16580096L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
	private static final long[] mk_tokenSet_6() {
		long[] data = { 23756734722L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
	private static final long[] mk_tokenSet_7() {
		long[] data = { 24830476546L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7());
	private static final long[] mk_tokenSet_8() {
		long[] data = { 9126936576L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8());
	private static final long[] mk_tokenSet_9() {
		long[] data = { 537001984L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_9 = new BitSet(mk_tokenSet_9());
	private static final long[] mk_tokenSet_10() {
		long[] data = { 70309218746368L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_10 = new BitSet(mk_tokenSet_10());
	private static final long[] mk_tokenSet_11() {
		long[] data = { 70343578484736L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_11 = new BitSet(mk_tokenSet_11());
	private static final long[] mk_tokenSet_12() {
		long[] data = { 9194045440L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_12 = new BitSet(mk_tokenSet_12());
	private static final long[] mk_tokenSet_13() {
		long[] data = { 13203333578752L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_13 = new BitSet(mk_tokenSet_13());
	private static final long[] mk_tokenSet_14() {
		long[] data = { 65979891712000L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_14 = new BitSet(mk_tokenSet_14());
	
	}
