// $ANTLR 2.7.2: "walker.g" -> "MxAntlrWalker.java"$

import antlr.TreeParser;
import antlr.Token;
import antlr.collections.AST;
import antlr.RecognitionException;
import antlr.ANTLRException;
import antlr.NoViableAltException;
import antlr.MismatchedTokenException;
import antlr.SemanticException;
import antlr.collections.impl.BitSet;
import antlr.ASTPair;
import antlr.collections.impl.ASTArray;

import java.io.*;
import java.util.*;


public class MxAntlrWalker extends antlr.TreeParser       implements MxAntlrWalkerTokenTypes
 {

    static MxDataType null_data = new MxDataType( "<NULL>" );
    MxInterpreter ipt = new MxInterpreter();
public MxAntlrWalker() {
	tokenNames = _tokenNames;
}

	public final  MxDataType  expr(AST _t) throws RecognitionException {
		 MxDataType r ;
		
		AST expr_AST_in = (AST)_t;
		AST right_or = null;
		AST right_and = null;
		AST c1 = null;
		AST c2 = null;
		AST num = null;
		AST str = null;
		AST id = null;
		AST forbody = null;
		AST thenp = null;
		AST elsep = null;
		AST stmt = null;
		AST loopbody = null;
		AST loopid = null;
		AST breakid = null;
		AST contid = null;
		AST fname = null;
		AST fbody = null;
		
		MxDataType a, b;
		Vector v;
		MxDataType[] x;
		String s = null;
		String[] sx;
		r = null_data;
		
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case LITERAL_or:
			{
				AST __t2 = _t;
				AST tmp1_AST_in = (AST)_t;
				match(_t,LITERAL_or);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				right_or = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				_t = __t2;
				_t = _t.getNextSibling();
				
				if ( a instanceof MxBool )
				r = ( ((MxBool)a).var ? a : expr(right_or) );
				else
				r = a.or( expr(right_or) );
				
				break;
			}
			case LITERAL_and:
			{
				AST __t3 = _t;
				AST tmp2_AST_in = (AST)_t;
				match(_t,LITERAL_and);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				right_and = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				_t = __t3;
				_t = _t.getNextSibling();
				
				if ( a instanceof MxBool )
				r = ( ((MxBool)a).var ? expr(right_and) : a );
				else
				r = a.and( expr(right_and) );
				
				break;
			}
			case LITERAL_not:
			{
				AST __t4 = _t;
				AST tmp3_AST_in = (AST)_t;
				match(_t,LITERAL_not);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				_t = __t4;
				_t = _t.getNextSibling();
				r = a.not();
				break;
			}
			case GE:
			{
				AST __t5 = _t;
				AST tmp4_AST_in = (AST)_t;
				match(_t,GE);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t5;
				_t = _t.getNextSibling();
				r = a.ge( b );
				break;
			}
			case LE:
			{
				AST __t6 = _t;
				AST tmp5_AST_in = (AST)_t;
				match(_t,LE);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t6;
				_t = _t.getNextSibling();
				r = a.le( b );
				break;
			}
			case GT:
			{
				AST __t7 = _t;
				AST tmp6_AST_in = (AST)_t;
				match(_t,GT);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t7;
				_t = _t.getNextSibling();
				r = a.gt( b );
				break;
			}
			case LT:
			{
				AST __t8 = _t;
				AST tmp7_AST_in = (AST)_t;
				match(_t,LT);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t8;
				_t = _t.getNextSibling();
				r = a.lt( b );
				break;
			}
			case EQ:
			{
				AST __t9 = _t;
				AST tmp8_AST_in = (AST)_t;
				match(_t,EQ);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t9;
				_t = _t.getNextSibling();
				r = a.eq( b );
				break;
			}
			case NEQ:
			{
				AST __t10 = _t;
				AST tmp9_AST_in = (AST)_t;
				match(_t,NEQ);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t10;
				_t = _t.getNextSibling();
				r = a.ne( b );
				break;
			}
			case PLUS:
			{
				AST __t11 = _t;
				AST tmp10_AST_in = (AST)_t;
				match(_t,PLUS);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t11;
				_t = _t.getNextSibling();
				r = a.plus( b );
				break;
			}
			case MINUS:
			{
				AST __t12 = _t;
				AST tmp11_AST_in = (AST)_t;
				match(_t,MINUS);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t12;
				_t = _t.getNextSibling();
				r = a.minus( b );
				break;
			}
			case MULT:
			{
				AST __t13 = _t;
				AST tmp12_AST_in = (AST)_t;
				match(_t,MULT);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t13;
				_t = _t.getNextSibling();
				r = a.times( b );
				break;
			}
			case LDV:
			{
				AST __t14 = _t;
				AST tmp13_AST_in = (AST)_t;
				match(_t,LDV);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t14;
				_t = _t.getNextSibling();
				r = a.lfracts( b );
				break;
			}
			case RDV:
			{
				AST __t15 = _t;
				AST tmp14_AST_in = (AST)_t;
				match(_t,RDV);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t15;
				_t = _t.getNextSibling();
				r = a.rfracts( b );
				break;
			}
			case MOD:
			{
				AST __t16 = _t;
				AST tmp15_AST_in = (AST)_t;
				match(_t,MOD);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t16;
				_t = _t.getNextSibling();
				r = a.modulus( b );
				break;
			}
			case UPLUS:
			{
				AST __t17 = _t;
				AST tmp16_AST_in = (AST)_t;
				match(_t,UPLUS);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				_t = __t17;
				_t = _t.getNextSibling();
				r = a;
				break;
			}
			case UMINUS:
			{
				AST __t18 = _t;
				AST tmp17_AST_in = (AST)_t;
				match(_t,UMINUS);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				_t = __t18;
				_t = _t.getNextSibling();
				r = a.uminus();
				break;
			}
			case PLUSEQ:
			{
				AST __t19 = _t;
				AST tmp18_AST_in = (AST)_t;
				match(_t,PLUSEQ);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t19;
				_t = _t.getNextSibling();
				r = a.add( b );
				break;
			}
			case MINUSEQ:
			{
				AST __t20 = _t;
				AST tmp19_AST_in = (AST)_t;
				match(_t,MINUSEQ);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t20;
				_t = _t.getNextSibling();
				r = a.sub( b );
				break;
			}
			case MULTEQ:
			{
				AST __t21 = _t;
				AST tmp20_AST_in = (AST)_t;
				match(_t,MULTEQ);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t21;
				_t = _t.getNextSibling();
				r = a.mul( b );
				break;
			}
			case LDVEQ:
			{
				AST __t22 = _t;
				AST tmp21_AST_in = (AST)_t;
				match(_t,LDVEQ);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t22;
				_t = _t.getNextSibling();
				r = a.ldiv( b );
				break;
			}
			case RDVEQ:
			{
				AST __t23 = _t;
				AST tmp22_AST_in = (AST)_t;
				match(_t,RDVEQ);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t23;
				_t = _t.getNextSibling();
				r = a.rdiv( b );
				break;
			}
			case MODEQ:
			{
				AST __t24 = _t;
				AST tmp23_AST_in = (AST)_t;
				match(_t,MODEQ);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t24;
				_t = _t.getNextSibling();
				r = a.rem( b );
				break;
			}
			case COLON:
			{
				AST __t25 = _t;
				AST tmp24_AST_in = (AST)_t;
				match(_t,COLON);
				_t = _t.getFirstChild();
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case ALPHA:
				case DIGIT:
				case WS:
				case NL:
				case COMMENT:
				case LDV_LDVEQ:
				case LPAREN:
				case RPAREN:
				case MULT:
				case PLUS:
				case MINUS:
				case RDV:
				case MOD:
				case SEMI:
				case LBRACE:
				case RBRACE:
				case LBRK:
				case RBRK:
				case ASGN:
				case COMMA:
				case PLUSEQ:
				case MINUSEQ:
				case MULTEQ:
				case RDVEQ:
				case MODEQ:
				case GE:
				case LE:
				case GT:
				case LT:
				case EQ:
				case NEQ:
				case TRSP:
				case COLON:
				case DCOLON:
				case ID:
				case NUMBER:
				case STRING:
				case STATEMENT:
				case ARRAY_ROW:
				case ARRAY:
				case VAR_LIST:
				case EXPR_LIST:
				case FUNC_CALL:
				case FOR_CON:
				case LOOP:
				case UPLUS:
				case UMINUS:
				case LITERAL_for:
				case LITERAL_if:
				case LITERAL_else:
				case LITERAL_loop:
				case LITERAL_break:
				case LITERAL_continue:
				case LITERAL_return:
				case LITERAL_include:
				case LDVEQ:
				case LITERAL_func:
				case LITERAL_or:
				case LITERAL_and:
				case LITERAL_not:
				case LDV:
				case LITERAL_true:
				case LITERAL_false:
				case LITERAL_exit:
				{
					c1 = (AST)_t;
					if ( _t==null ) throw new MismatchedTokenException();
					_t = _t.getNextSibling();
					{
					if (_t==null) _t=ASTNULL;
					switch ( _t.getType()) {
					case ALPHA:
					case DIGIT:
					case WS:
					case NL:
					case COMMENT:
					case LDV_LDVEQ:
					case LPAREN:
					case RPAREN:
					case MULT:
					case PLUS:
					case MINUS:
					case RDV:
					case MOD:
					case SEMI:
					case LBRACE:
					case RBRACE:
					case LBRK:
					case RBRK:
					case ASGN:
					case COMMA:
					case PLUSEQ:
					case MINUSEQ:
					case MULTEQ:
					case RDVEQ:
					case MODEQ:
					case GE:
					case LE:
					case GT:
					case LT:
					case EQ:
					case NEQ:
					case TRSP:
					case COLON:
					case DCOLON:
					case ID:
					case NUMBER:
					case STRING:
					case STATEMENT:
					case ARRAY_ROW:
					case ARRAY:
					case VAR_LIST:
					case EXPR_LIST:
					case FUNC_CALL:
					case FOR_CON:
					case LOOP:
					case UPLUS:
					case UMINUS:
					case LITERAL_for:
					case LITERAL_if:
					case LITERAL_else:
					case LITERAL_loop:
					case LITERAL_break:
					case LITERAL_continue:
					case LITERAL_return:
					case LITERAL_include:
					case LDVEQ:
					case LITERAL_func:
					case LITERAL_or:
					case LITERAL_and:
					case LITERAL_not:
					case LDV:
					case LITERAL_true:
					case LITERAL_false:
					case LITERAL_exit:
					{
						c2 = (AST)_t;
						if ( _t==null ) throw new MismatchedTokenException();
						_t = _t.getNextSibling();
						break;
					}
					case 3:
					{
						break;
					}
					default:
					{
						throw new NoViableAltException(_t);
					}
					}
					}
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				_t = __t25;
				_t = _t.getNextSibling();
				
				r = MxRange.create( (null==c1) ? null : expr(c1), 
				(null==c2) ? null : expr(c2) ); 
				
				break;
			}
			case DCOLON:
			{
				AST __t28 = _t;
				AST tmp25_AST_in = (AST)_t;
				match(_t,DCOLON);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t28;
				_t = _t.getNextSibling();
				r = MxRange.create( a, b, 1 );
				break;
			}
			case ASGN:
			{
				AST __t29 = _t;
				AST tmp26_AST_in = (AST)_t;
				match(_t,ASGN);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				b=expr(_t);
				_t = _retTree;
				_t = __t29;
				_t = _t.getNextSibling();
				r = ipt.assign( a, b );
				break;
			}
			case FUNC_CALL:
			{
				AST __t30 = _t;
				AST tmp27_AST_in = (AST)_t;
				match(_t,FUNC_CALL);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				x=mexpr(_t);
				_t = _retTree;
				_t = __t30;
				_t = _t.getNextSibling();
				r = ipt.funcInvoke( this, a, x );
				break;
			}
			case ARRAY:
			{
				AST __t31 = _t;
				AST tmp28_AST_in = (AST)_t;
				match(_t,ARRAY);
				_t = _t.getFirstChild();
				v = new Vector();
				{
				_loop33:
				do {
					if (_t==null) _t=ASTNULL;
					if ((_tokenSet_0.member(_t.getType()))) {
						a=expr(_t);
						_t = _retTree;
						v.add( a );
					}
					else {
						break _loop33;
					}
					
				} while (true);
				}
				_t = __t31;
				_t = _t.getNextSibling();
				r = MxMatrix.joinVert( ipt.convertExprList( v ) );
				break;
			}
			case ARRAY_ROW:
			{
				AST __t34 = _t;
				AST tmp29_AST_in = (AST)_t;
				match(_t,ARRAY_ROW);
				_t = _t.getFirstChild();
				v = new Vector();
				{
				int _cnt36=0;
				_loop36:
				do {
					if (_t==null) _t=ASTNULL;
					if ((_tokenSet_0.member(_t.getType()))) {
						a=expr(_t);
						_t = _retTree;
						v.add( a );
					}
					else {
						if ( _cnt36>=1 ) { break _loop36; } else {throw new NoViableAltException(_t);}
					}
					
					_cnt36++;
				} while (true);
				}
				_t = __t34;
				_t = _t.getNextSibling();
				r = MxMatrix.joinHori( ipt.convertExprList( v ) );
				break;
			}
			case NUMBER:
			{
				num = (AST)_t;
				match(_t,NUMBER);
				_t = _t.getNextSibling();
				r = ipt.getNumber( num.getText() );
				break;
			}
			case STRING:
			{
				str = (AST)_t;
				match(_t,STRING);
				_t = _t.getNextSibling();
				r = new MxString( str.getText() );
				break;
			}
			case LITERAL_true:
			{
				AST tmp30_AST_in = (AST)_t;
				match(_t,LITERAL_true);
				_t = _t.getNextSibling();
				r = new MxBool( true );
				break;
			}
			case LITERAL_false:
			{
				AST tmp31_AST_in = (AST)_t;
				match(_t,LITERAL_false);
				_t = _t.getNextSibling();
				r = new MxBool( false );
				break;
			}
			case ID:
			{
				AST __t37 = _t;
				id = _t==ASTNULL ? null :(AST)_t;
				match(_t,ID);
				_t = _t.getFirstChild();
				r = ipt.getVariable( id.getText() );
				{
				_loop39:
				do {
					if (_t==null) _t=ASTNULL;
					if ((_tokenSet_1.member(_t.getType()))) {
						x=mexpr(_t);
						_t = _retTree;
						r = ipt.subMatrix( r, x );
					}
					else {
						break _loop39;
					}
					
				} while (true);
				}
				_t = __t37;
				_t = _t.getNextSibling();
				break;
			}
			case TRSP:
			{
				AST __t40 = _t;
				AST tmp32_AST_in = (AST)_t;
				match(_t,TRSP);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				_t = __t40;
				_t = _t.getNextSibling();
				r = a.transpose();
				break;
			}
			case LITERAL_for:
			{
				AST __t41 = _t;
				AST tmp33_AST_in = (AST)_t;
				match(_t,LITERAL_for);
				_t = _t.getFirstChild();
				x=mexpr(_t);
				_t = _retTree;
				forbody = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				_t = __t41;
				_t = _t.getNextSibling();
				
				MxInt[] values = ipt.forInit( x );
				while ( ipt.forCanProceed( x, values ) ) 
				{
				r = expr( forbody );
				ipt.forNext( x, values );
				}
				ipt.forEnd( x );
				
				break;
			}
			case LITERAL_if:
			{
				AST __t42 = _t;
				AST tmp34_AST_in = (AST)_t;
				match(_t,LITERAL_if);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				thenp = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case ALPHA:
				case DIGIT:
				case WS:
				case NL:
				case COMMENT:
				case LDV_LDVEQ:
				case LPAREN:
				case RPAREN:
				case MULT:
				case PLUS:
				case MINUS:
				case RDV:
				case MOD:
				case SEMI:
				case LBRACE:
				case RBRACE:
				case LBRK:
				case RBRK:
				case ASGN:
				case COMMA:
				case PLUSEQ:
				case MINUSEQ:
				case MULTEQ:
				case RDVEQ:
				case MODEQ:
				case GE:
				case LE:
				case GT:
				case LT:
				case EQ:
				case NEQ:
				case TRSP:
				case COLON:
				case DCOLON:
				case ID:
				case NUMBER:
				case STRING:
				case STATEMENT:
				case ARRAY_ROW:
				case ARRAY:
				case VAR_LIST:
				case EXPR_LIST:
				case FUNC_CALL:
				case FOR_CON:
				case LOOP:
				case UPLUS:
				case UMINUS:
				case LITERAL_for:
				case LITERAL_if:
				case LITERAL_else:
				case LITERAL_loop:
				case LITERAL_break:
				case LITERAL_continue:
				case LITERAL_return:
				case LITERAL_include:
				case LDVEQ:
				case LITERAL_func:
				case LITERAL_or:
				case LITERAL_and:
				case LITERAL_not:
				case LDV:
				case LITERAL_true:
				case LITERAL_false:
				case LITERAL_exit:
				{
					elsep = (AST)_t;
					if ( _t==null ) throw new MismatchedTokenException();
					_t = _t.getNextSibling();
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				_t = __t42;
				_t = _t.getNextSibling();
				
				if ( !( a instanceof MxBool ) )
				return a.error( "if: expression should be bool" );
				if ( ((MxBool)a).var )
				r = expr( thenp );
				else if ( null != elsep )
				r = expr( elsep );
				
				break;
			}
			case STATEMENT:
			{
				AST __t44 = _t;
				AST tmp35_AST_in = (AST)_t;
				match(_t,STATEMENT);
				_t = _t.getFirstChild();
				{
				_loop46:
				do {
					if (_t==null) _t=ASTNULL;
					if (((_t.getType() >= ALPHA && _t.getType() <= LITERAL_exit))) {
						stmt = (AST)_t;
						if ( _t==null ) throw new MismatchedTokenException();
						_t = _t.getNextSibling();
						if ( ipt.canProceed() ) r = expr(stmt);
					}
					else {
						break _loop46;
					}
					
				} while (true);
				}
				_t = __t44;
				_t = _t.getNextSibling();
				break;
			}
			case LOOP:
			{
				AST __t47 = _t;
				AST tmp36_AST_in = (AST)_t;
				match(_t,LOOP);
				_t = _t.getFirstChild();
				loopbody = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case ID:
				{
					loopid = (AST)_t;
					match(_t,ID);
					_t = _t.getNextSibling();
					s = loopid.getText();
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				_t = __t47;
				_t = _t.getNextSibling();
				
				while ( ipt.canProceed() ) 
				{
				r = expr( loopbody );
				ipt.loopNext( s );
				}
				ipt.loopEnd( s );
				
				break;
			}
			case LITERAL_break:
			{
				AST __t49 = _t;
				AST tmp37_AST_in = (AST)_t;
				match(_t,LITERAL_break);
				_t = _t.getFirstChild();
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case ID:
				{
					breakid = (AST)_t;
					match(_t,ID);
					_t = _t.getNextSibling();
					s = breakid.getText();
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				_t = __t49;
				_t = _t.getNextSibling();
				ipt.setBreak( s );
				break;
			}
			case LITERAL_continue:
			{
				AST __t51 = _t;
				AST tmp38_AST_in = (AST)_t;
				match(_t,LITERAL_continue);
				_t = _t.getFirstChild();
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case ID:
				{
					contid = (AST)_t;
					match(_t,ID);
					_t = _t.getNextSibling();
					s = contid.getText();
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				_t = __t51;
				_t = _t.getNextSibling();
				ipt.setContinue( s );
				break;
			}
			case LITERAL_return:
			{
				AST __t53 = _t;
				AST tmp39_AST_in = (AST)_t;
				match(_t,LITERAL_return);
				_t = _t.getFirstChild();
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case MULT:
				case PLUS:
				case MINUS:
				case RDV:
				case MOD:
				case ASGN:
				case PLUSEQ:
				case MINUSEQ:
				case MULTEQ:
				case RDVEQ:
				case MODEQ:
				case GE:
				case LE:
				case GT:
				case LT:
				case EQ:
				case NEQ:
				case TRSP:
				case COLON:
				case DCOLON:
				case ID:
				case NUMBER:
				case STRING:
				case STATEMENT:
				case ARRAY_ROW:
				case ARRAY:
				case FUNC_CALL:
				case LOOP:
				case UPLUS:
				case UMINUS:
				case LITERAL_for:
				case LITERAL_if:
				case LITERAL_break:
				case LITERAL_continue:
				case LITERAL_return:
				case LITERAL_include:
				case LDVEQ:
				case LITERAL_func:
				case LITERAL_or:
				case LITERAL_and:
				case LITERAL_not:
				case LDV:
				case LITERAL_true:
				case LITERAL_false:
				{
					a=expr(_t);
					_t = _retTree;
					r = ipt.rvalue( a );
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				_t = __t53;
				_t = _t.getNextSibling();
				ipt.setReturn( null );
				break;
			}
			case LITERAL_func:
			{
				AST __t55 = _t;
				AST tmp40_AST_in = (AST)_t;
				match(_t,LITERAL_func);
				_t = _t.getFirstChild();
				fname = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				sx=vlist(_t);
				_t = _retTree;
				fbody = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				_t = __t55;
				_t = _t.getNextSibling();
				ipt.funcRegister( fname.getText(), sx, fbody );
				break;
			}
			case LITERAL_include:
			{
				AST __t56 = _t;
				AST tmp41_AST_in = (AST)_t;
				match(_t,LITERAL_include);
				_t = _t.getFirstChild();
				a=expr(_t);
				_t = _retTree;
				_t = __t56;
				_t = _t.getNextSibling();
				ipt.include( a );
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
		return r ;
	}
	
	public final  MxDataType[]  mexpr(AST _t) throws RecognitionException {
		 MxDataType[] rv ;
		
		AST mexpr_AST_in = (AST)_t;
		AST s = null;
		
		MxDataType a;
		rv = null;
		Vector v;
		
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case EXPR_LIST:
			{
				AST __t58 = _t;
				AST tmp42_AST_in = (AST)_t;
				match(_t,EXPR_LIST);
				_t = _t.getFirstChild();
				v = new Vector();
				{
				_loop60:
				do {
					if (_t==null) _t=ASTNULL;
					if ((_tokenSet_0.member(_t.getType()))) {
						a=expr(_t);
						_t = _retTree;
						v.add( a );
					}
					else {
						break _loop60;
					}
					
				} while (true);
				}
				_t = __t58;
				_t = _t.getNextSibling();
				rv = ipt.convertExprList( v );
				break;
			}
			case MULT:
			case PLUS:
			case MINUS:
			case RDV:
			case MOD:
			case ASGN:
			case PLUSEQ:
			case MINUSEQ:
			case MULTEQ:
			case RDVEQ:
			case MODEQ:
			case GE:
			case LE:
			case GT:
			case LT:
			case EQ:
			case NEQ:
			case TRSP:
			case COLON:
			case DCOLON:
			case ID:
			case NUMBER:
			case STRING:
			case STATEMENT:
			case ARRAY_ROW:
			case ARRAY:
			case FUNC_CALL:
			case LOOP:
			case UPLUS:
			case UMINUS:
			case LITERAL_for:
			case LITERAL_if:
			case LITERAL_break:
			case LITERAL_continue:
			case LITERAL_return:
			case LITERAL_include:
			case LDVEQ:
			case LITERAL_func:
			case LITERAL_or:
			case LITERAL_and:
			case LITERAL_not:
			case LDV:
			case LITERAL_true:
			case LITERAL_false:
			{
				a=expr(_t);
				_t = _retTree;
				rv = new MxDataType[1]; rv[0] = a;
				break;
			}
			case FOR_CON:
			{
				AST __t61 = _t;
				AST tmp43_AST_in = (AST)_t;
				match(_t,FOR_CON);
				_t = _t.getFirstChild();
				v = new Vector();
				{
				int _cnt63=0;
				_loop63:
				do {
					if (_t==null) _t=ASTNULL;
					if ((_t.getType()==ID)) {
						s = (AST)_t;
						match(_t,ID);
						_t = _t.getNextSibling();
						a=expr(_t);
						_t = _retTree;
						a.setName( s.getText() ); v.add(a);
					}
					else {
						if ( _cnt63>=1 ) { break _loop63; } else {throw new NoViableAltException(_t);}
					}
					
					_cnt63++;
				} while (true);
				}
				_t = __t61;
				_t = _t.getNextSibling();
				rv = ipt.convertExprList( v );
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
		return rv ;
	}
	
	public final  String[]  vlist(AST _t) throws RecognitionException {
		 String[] sv ;
		
		AST vlist_AST_in = (AST)_t;
		AST s = null;
		
		Vector v;
		sv = null;
		
		
		try {      // for error handling
			AST __t65 = _t;
			AST tmp44_AST_in = (AST)_t;
			match(_t,VAR_LIST);
			_t = _t.getFirstChild();
			v = new Vector();
			{
			_loop67:
			do {
				if (_t==null) _t=ASTNULL;
				if ((_t.getType()==ID)) {
					s = (AST)_t;
					match(_t,ID);
					_t = _t.getNextSibling();
					v.add( s.getText() );
				}
				else {
					break _loop67;
				}
				
			} while (true);
			}
			_t = __t65;
			_t = _t.getNextSibling();
			sv = ipt.convertVarList( v );
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
		return sv ;
	}
	
	
	public static final String[] _tokenNames = {
		"<0>",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"ALPHA",
		"DIGIT",
		"WS",
		"NL",
		"COMMENT",
		"LDV_LDVEQ",
		"LPAREN",
		"RPAREN",
		"MULT",
		"PLUS",
		"MINUS",
		"RDV",
		"MOD",
		"SEMI",
		"LBRACE",
		"RBRACE",
		"LBRK",
		"RBRK",
		"ASGN",
		"COMMA",
		"PLUSEQ",
		"MINUSEQ",
		"MULTEQ",
		"RDVEQ",
		"MODEQ",
		"GE",
		"LE",
		"GT",
		"LT",
		"EQ",
		"NEQ",
		"TRSP",
		"COLON",
		"DCOLON",
		"ID",
		"NUMBER",
		"STRING",
		"STATEMENT",
		"ARRAY_ROW",
		"ARRAY",
		"VAR_LIST",
		"EXPR_LIST",
		"FUNC_CALL",
		"FOR_CON",
		"LOOP",
		"UPLUS",
		"UMINUS",
		"\"for\"",
		"\"if\"",
		"\"else\"",
		"\"loop\"",
		"\"break\"",
		"\"continue\"",
		"\"return\"",
		"\"include\"",
		"LDVEQ",
		"\"func\"",
		"\"or\"",
		"\"and\"",
		"\"not\"",
		"LDV",
		"\"true\"",
		"\"false\"",
		"\"exit\""
	};
	
	private static final long[] mk_tokenSet_0() {
		long[] data = { -27215111823167488L, 7L, 0L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
	private static final long[] mk_tokenSet_1() {
		long[] data = { -27039189962723328L, 7L, 0L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
	}
	
