// $ANTLR 2.7.5 (20050201): "GECLgrammar.g" -> "GECLWalker.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.PrintWriter;
	import java.io.IOException;
	import java.lang.Object;
	import wdcor.WorldCoords;


public class GECLWalker extends antlr.TreeParser       implements GECLLexerTokenTypes
 {

    java.util.Hashtable dict = new java.util.Hashtable();
    java.util.Hashtable PerspTab = new java.util.Hashtable();
    int count=0;
    int countp=0;
    GECLdatatypes[] b = new GECLdatatypes[100];
    GECLdatatypes[] tm = new GECLdatatypes[100];
    PerspectType[] pr = new PerspectType[100];
    Distance sep_dist;
    GECLlibrary kk = new GECLlibrary();
	
	
	int tabs = 0;		
	int if_break = 0;
	int if_continue = 0;
	int if_skip_rcurly = 0;
	int if_state = 1;
	
	float recursive_f(AST rec_root)
	{
		AST e1, e2;
		int entry_index;
        
		//first check if this root is binary operator, if yes, then it will recursively go to next level
		//if not, then just evaluate and return the value
		if(rec_root == null)
			return 0;
		else if(rec_root.getText().length()==0)
		{
			return recursive_f(rec_root.getFirstChild());
		}
		else if(rec_root.getText().equals("-"))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			return (recursive_f(e1) - recursive_f(e2));
		}
		else if(rec_root.getText().equals("*"))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			return (recursive_f(e1) * recursive_f(e2));
		}
		else if(rec_root.getText().equals("+"))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			return (recursive_f(e1) + recursive_f(e2));
		}
		else if(rec_root.getText().equals("/"))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			return (recursive_f(e1) / recursive_f(e2));
		}	
		else if(rec_root.getText().equals("="))
		{
			// assign to left node, left node must be ID
			e1 = (AST) rec_root.getFirstChild();	
			e2 = (AST) e1.getNextSibling();
			
			if( !(dict.containsKey(e1.getText()))) //this is number, make no sense to assign to number, so skip assing operator
			{			
				recursive_f(e2);
				return Float.parseFloat(e1.getText());
			}
			else // this is ID, could be assigned value
			{
				entry_index=(Integer)dict.get( e1.getText());				
				if(b[entry_index].type == "int")
				{
					b[entry_index].int_value = (int) recursive_f(e2);
					return b[entry_index].int_value;
				}
				else if(b[entry_index].type == "float")
				{
					b[entry_index].float_value = recursive_f(e2);
					return b[entry_index].float_value;
				}
				return recursive_f(e2);
			}
		}
		else if(rec_root.getText().equals("+="))
		{
			// assign to left node, left node must be ID
			e1 = (AST) rec_root.getFirstChild();	
			e2 = (AST) e1.getNextSibling();
			
			if( !(dict.containsKey(e1.getText()))) //this is number, make no sense to assign to number, so skip assing operator
			{			
				recursive_f(e2);
				return Float.parseFloat(e1.getText());
			}
			else // this is ID, could be assigned value
			{
				entry_index=(Integer)dict.get( e1.getText());
				
				if(b[entry_index].type == "int")
				{
					b[entry_index].int_value += (int) recursive_f(e2);
					return b[entry_index].int_value;
				}
				else if(b[entry_index].type == "float")
				{
					b[entry_index].float_value += recursive_f(e2);
					return b[entry_index].float_value;
				}
				return recursive_f(e2);
			}
		}
		else if(rec_root.getText().equals("-="))
		{
			// assign to left node, left node must be ID
			e1 = (AST) rec_root.getFirstChild();	
			e2 = (AST) e1.getNextSibling();
			
			if( !(dict.containsKey(e1.getText()))) //this is number, make no sense to assign to number, so skip assing operator
			{			
				recursive_f(e2);
				return Float.parseFloat(e1.getText());
			}
			else // this is ID, could be assigned value
			{
				entry_index=(Integer)dict.get( e1.getText());
				if(b[entry_index].type == "int")
				{
					b[entry_index].int_value -= (int) recursive_f(e2);
					return b[entry_index].int_value;
				}
				else if(b[entry_index].type == "float")
				{
					b[entry_index].float_value -= recursive_f(e2);
					return b[entry_index].float_value;
				}
				return recursive_f(e2);
			}
		}
		else if(rec_root.getText().equals("*="))
		{
			// assign to left node, left node must be ID
			e1 = (AST) rec_root.getFirstChild();	
			e2 = (AST) e1.getNextSibling();
			
			if( !(dict.containsKey(e1.getText()))) //this is number, make no sense to assign to number, so skip assing operator
			{			
				recursive_f(e2);
				return Float.parseFloat(e1.getText());
			}
			else // this is ID, could be assigned value
			{
				entry_index=(Integer)dict.get( e1.getText());
				
				if(b[entry_index].type == "int")
				{
					b[entry_index].int_value *= (int) recursive_f(e2);
					return b[entry_index].int_value;
				}
				else if(b[entry_index].type == "float")
				{
					b[entry_index].float_value *= recursive_f(e2);
					return b[entry_index].float_value;
				}
				return recursive_f(e2);
			}
		}
		else if(rec_root.getText().equals("/="))
		{
			// assign to left node, left node must be ID
			e1 = (AST) rec_root.getFirstChild();	
			e2 = (AST) e1.getNextSibling();
			
			if( !(dict.containsKey(e1.getText()))) //this is number, make no sense to assign to number, so skip assing operator
			{			
				recursive_f(e2);
				return Float.parseFloat(e1.getText());
			}
			else // this is ID, could be assigned value
			{
				entry_index=(Integer)dict.get( e1.getText());
				
				if(b[entry_index].type == "int")
				{
					b[entry_index].int_value /= (int) recursive_f(e2);
					return b[entry_index].int_value;
				}
				else if(b[entry_index].type == "float")
				{
					b[entry_index].float_value /= recursive_f(e2);
					return b[entry_index].float_value;
				}
				return recursive_f(e2);
			}
		}
		else if(rec_root.getText().equals("=="))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			if( recursive_f(e1) == recursive_f(e2))
				return 1;
			return -1;
		}
		
		else if(rec_root.getText().equals("!="))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			if( recursive_f(e1) != recursive_f(e2))
				return 1;
			return 0;
		}
		else if(rec_root.getText().equals("<"))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			if( recursive_f(e1) < recursive_f(e2))
				return 1;
			return -1;
		}
		else if(rec_root.getText().equals(">"))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			if( recursive_f(e1) > recursive_f(e2))
				return 1;
			return -1;
		}
		else if(rec_root.getText().equals("<="))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			if( recursive_f(e1) <= recursive_f(e2))
				return 1;
			return 0;
		}
		else if(rec_root.getText().equals(">="))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			if( recursive_f(e1) >= recursive_f(e2))
				return 1;
			return 0;
		}		
		else if(rec_root.getText().equals("&&"))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			int tempi1 = (int) recursive_f(e1);
			int tempi2 = (int) recursive_f(e2);
			if(tempi1>0 && tempi2>0)
				return 1;
			return 0;
		}
		else if(rec_root.getText().equals("||"))
		{
			e1 = (AST) rec_root.getFirstChild();
			e2 = (AST) e1.getNextSibling();
			int tempi1 = (int) recursive_f(e1);
			int tempi2 = (int) recursive_f(e2);
			if(tempi1>0 || tempi2>0)
				return 1;
			return 0;
		}
		else if(rec_root.getText().equals("break"))
		{
			if_break = 1;
			return 1;
		}
		else if(rec_root.getText().equals("continue"))
		{
			if_continue = 1;
			return 1;
		}
		else if(rec_root.getText().equals("++"))
		{
			// assign to left node, left node must be ID
			e1 = (AST) rec_root.getFirstChild();	
			entry_index=(Integer)dict.get( e1.getText());
				
			if(b[entry_index].type == "int")
			{
				return (b[entry_index].int_value++);
			}
			else if(b[entry_index].type == "float")
			{
				return (b[entry_index].float_value++);
			}
			return 0;
		}
		else if(rec_root.getText().equals("--"))
		{
			// assign to left node, left node must be ID
			e1 = (AST) rec_root.getFirstChild();	
			entry_index=(Integer)dict.get( e1.getText());
				
			if(b[entry_index].type == "int")
			{
				return (b[entry_index].int_value--);
			}
			else if(b[entry_index].type == "float")
			{
				return (b[entry_index].float_value--);
			}
			return 0;
		}		
		else
		{
			if( !(dict.containsKey(rec_root.getText()))) //this is number
			{			
				return Float.parseFloat(rec_root.getText());
			}
    		else //this is id
			{
				entry_index=(Integer)dict.get( rec_root.getText());
				
				if(b[entry_index].type == "int")
					return b[entry_index].int_value;
				else if(b[entry_index].type == "float")
					return b[entry_index].float_value;
				else
				{
					return 0;
					//not in our consideration now
				}		
			}				
		}
	}
	
public GECLWalker() {
	tokenNames = _tokenNames;
}

	public final void program(AST _t) throws RecognitionException {
		
		AST program_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		int dummy;
		
		try {      // for error handling
			AST __t156 = _t;
			AST tmp209_AST_in = (AST)_t;
			match(_t,PROGRAM_AST);
			_t = _t.getFirstChild();
			
			kk.creatkml();
			kk.sortCityCoords();
			
			{
			int _cnt158=0;
			_loop158:
			do {
				if (_t==null) _t=ASTNULL;
				if ((_tokenSet_0.member(_t.getType()))) {
					dummy=stmt(_t);
					_t = _retTree;
					
					System.out.println("obj number count = " + (count-1));
					
				}
				else {
					if ( _cnt158>=1 ) { break _loop158; } else {throw new NoViableAltException(_t);}
				}
				
				_cnt158++;
			} while (true);
			}
			kk.endkml();
			_t = __t156;
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final int  stmt(AST _t) throws RecognitionException {
		int dummy;
		
		AST stmt_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		AST m1 = null;
		AST f1 = null;
		AST m2 = null;
		AST f2 = null;
		AST as1 = null;
		AST as2 = null;
		AST as3 = null;
		AST s1 = null;
		AST s2 = null;
		AST s3 = null;
		AST s4 = null;
		AST s5 = null;
		AST pla1 = null;
		AST s6 = null;
		AST f3 = null;
		AST f4 = null;
		AST s7 = null;
		AST f5 = null;
		AST f6 = null;
		AST f7 = null;
		AST s8 = null;
		AST ovs1 = null;
		AST ovs2 = null;
		AST ovs3 = null;
		AST ovs4 = null;
		AST ovs5 = null;
		AST ovs6 = null;
		AST psp1 = null;
		AST psp2 = null;
		AST psp3 = null;
		AST psp4 = null;
		AST ln1 = null;
		AST type = null;
		AST i1 = null;
		AST f21 = null;
		AST scale1 = null;
		AST translate_x1 = null;
		AST translate_y1 = null;
		AST translate_z1 = null;
		AST st21 = null;
		dummy=0;float ii=0.0f; float jj=0.0f;float kf=0.0f;double dd=0.0d;
		int tempi1 = 0;
		float tempf1 = 0.0f;
		
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case LITERAL_dist:
			{
				AST __t160 = _t;
				AST tmp210_AST_in = (AST)_t;
				match(_t,LITERAL_dist);
				_t = _t.getFirstChild();
				
							b[count] = new GECLdatatypes();
							b[count].settype("distance");
				AST tmp211_AST_in = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				b[count].setname(tmp211_AST_in.getText());             
						dict.put(tmp211_AST_in.getText(),count);
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case DIST:
				{
					AST tmp212_AST_in = (AST)_t;
					match(_t,DIST);
					_t = _t.getNextSibling();
					b[count].setdists( tmp212_AST_in.getText());
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				count++;
				_t = __t160;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_coord:
			{
				AST __t162 = _t;
				AST tmp213_AST_in = (AST)_t;
				match(_t,LITERAL_coord);
				_t = _t.getFirstChild();
				
							 b[count] = new GECLdatatypes();
							 b[count].settype("coord");
				AST tmp214_AST_in = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				b[count].setname(tmp214_AST_in.getText());             
						dict.put(tmp214_AST_in.getText(),count);
				b[count].setcoord( ii,jj,"0ft");
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case MINUS:
				case FLOAT:
				{
					{
					if (_t==null) _t=ASTNULL;
					switch ( _t.getType()) {
					case MINUS:
					{
						{
						AST tmp215_AST_in = (AST)_t;
						match(_t,MINUS);
						_t = _t.getNextSibling();
						{
						m1 = (AST)_t;
						match(_t,FLOAT);
						_t = _t.getNextSibling();
						ii=Float.parseFloat(m1.getText()); ii=0-ii;
						}
						}
						break;
					}
					case FLOAT:
					{
						{
						f1 = (AST)_t;
						match(_t,FLOAT);
						_t = _t.getNextSibling();
						ii=Float.parseFloat(f1.getText());
						}
						break;
					}
					default:
					{
						throw new NoViableAltException(_t);
					}
					}
					}
					{
					if (_t==null) _t=ASTNULL;
					switch ( _t.getType()) {
					case MINUS:
					{
						{
						AST tmp216_AST_in = (AST)_t;
						match(_t,MINUS);
						_t = _t.getNextSibling();
						{
						m2 = (AST)_t;
						match(_t,FLOAT);
						_t = _t.getNextSibling();
						jj=Float.parseFloat(m2.getText()); jj=0-jj;
						}
						}
						break;
					}
					case FLOAT:
					{
						{
						f2 = (AST)_t;
						match(_t,FLOAT);
						_t = _t.getNextSibling();
						jj=Float.parseFloat(f2.getText());
						}
						break;
					}
					default:
					{
						throw new NoViableAltException(_t);
					}
					}
					}
					AST tmp217_AST_in = (AST)_t;
					match(_t,DIST);
					_t = _t.getNextSibling();
					b[count].setcoord( ii,jj,tmp217_AST_in.getText());
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				count++;
				_t = __t162;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_AsigCity:
			{
				AST __t172 = _t;
				AST tmp218_AST_in = (AST)_t;
				match(_t,LITERAL_AsigCity);
				_t = _t.getFirstChild();
				
				as1 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				if(!(dict.containsKey(as1.getText()))) kk.reportError("not a valid city", as1.getText());
				else dummy=(Integer)dict.get(as1.getText());          
				
				as2 = (AST)_t;
				match(_t,StringConstant);
				_t = _t.getNextSibling();
				as3 = (AST)_t;
				match(_t,StringConstant);
				_t = _t.getNextSibling();
				
				WorldCoords tmp=kk.getCityCoords(as2.getText(),as3.getText());
				b[dummy].setCityCoords(tmp);
				_t = __t172;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_point:
			{
				AST __t173 = _t;
				AST tmp219_AST_in = (AST)_t;
				match(_t,LITERAL_point);
				_t = _t.getFirstChild();
				
							 b[count] = new GECLdatatypes();
							 b[count].settype("point");
				
				s1 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				b[count].setname(s1.getText());             
						dict.put(s1.getText(),count);
				s2 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				
				if(!(dict.containsKey(s2.getText()))) kk.reportError("unrecognized", s2.getText());
				else {
				dummy=(Integer)dict.get(s2.getText());
				if(b[dummy].gettype()!="coord")
				kk.reportError("not a coordinate", s2.getText());
				else 
				b[count].cpy(b[dummy]);
				}
				count++;   
					
				_t = __t173;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_place:
			{
				AST __t174 = _t;
				AST tmp220_AST_in = (AST)_t;
				match(_t,LITERAL_place);
				_t = _t.getFirstChild();
				
							 b[count] = new GECLdatatypes();
							 b[count].settype("place");
				s3 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				b[count].setname(s3.getText());             
						dict.put(s3.getText(),count);
				s4 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				
							if(!(dict.containsKey(s4.getText()))) kk.reportError("unrecognized", s4.getText());
						else {
						      dummy=(Integer)dict.get(s4.getText()); 
				if(b[dummy].gettype()!="point")
				kk.reportError("not a point", s4.getText());
				else 
				b[count].cpy(b[dummy]);
						     }         
					
				s5 = (AST)_t;
				match(_t,StringConstant);
				_t = _t.getNextSibling();
				
					                b[count].settitle(s5.getText());
					
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case ID:
				{
					pla1 = (AST)_t;
					match(_t,ID);
					_t = _t.getNextSibling();
					
								if(!(PerspTab.containsKey(pla1.getText()))) kk.reportError("unrecognized", pla1.getText());
							else {
							      dummy=(Integer)PerspTab.get(pla1.getText()); 
					b[count].setpersp(pr[dummy]);
							     }         
						
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				count++;
				_t = __t174;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_struct:
			{
				AST __t176 = _t;
				AST tmp221_AST_in = (AST)_t;
				match(_t,LITERAL_struct);
				_t = _t.getFirstChild();
					b[count] = new GECLdatatypes();
							 	b[count].settype("struct");                	
				s6 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
					b[count].setname(s6.getText());             
							dict.put(s6.getText(),count);				
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case LITERAL_square:
				case LITERAL_rectangle:
				case LITERAL_triangle:
				{
					{
					if (_t==null) _t=ASTNULL;
					switch ( _t.getType()) {
					case LITERAL_square:
					{
						{
						AST tmp222_AST_in = (AST)_t;
						match(_t,LITERAL_square);
						_t = _t.getNextSibling();
						b[count].setshape("square");
						f3 = (AST)_t;
						match(_t,FLOAT);
						_t = _t.getNextSibling();
						ii=Float.parseFloat(f3.getText());
						f4 = (AST)_t;
						match(_t,FLOAT);
						_t = _t.getNextSibling();
						jj=Float.parseFloat(f4.getText());
						s7 = (AST)_t;
						match(_t,ID);
						_t = _t.getNextSibling();
						
												if( !(dict.containsKey(s7.getText()))) {
												kk.reportError("unrecognized: ",s7.getText());
											}else {
								      		dummy=(Integer)dict.get(s7.getText()); 
								      		b[count].cpy(b[dummy]);
								     		}
								     	 	b[count].setsquare(ii,jj);           
							           		
						}
						break;
					}
					case LITERAL_rectangle:
					{
						{
						AST tmp223_AST_in = (AST)_t;
						match(_t,LITERAL_rectangle);
						_t = _t.getNextSibling();
						b[count].setshape("rectangle");
						f5 = (AST)_t;
						match(_t,FLOAT);
						_t = _t.getNextSibling();
						ii=Float.parseFloat(f5.getText());
						f6 = (AST)_t;
						match(_t,FLOAT);
						_t = _t.getNextSibling();
						jj=Float.parseFloat(f6.getText());
						f7 = (AST)_t;
						match(_t,FLOAT);
						_t = _t.getNextSibling();
						kf=Float.parseFloat(f7.getText());
						s8 = (AST)_t;
						match(_t,ID);
						_t = _t.getNextSibling();
						
												if( !(dict.containsKey(s8.getText()))) {
												kk.reportError("unrecognized: ",s8.getText());
											}else {
								      		dummy=(Integer)dict.get(s8.getText()); 
								      		b[count].cpy(b[dummy]);
								     		}
								     	 	b[count].setrect(ii,jj,kf);           
							        		
						}
						break;
					}
					case LITERAL_triangle:
					{
						{
						AST tmp224_AST_in = (AST)_t;
						match(_t,LITERAL_triangle);
						_t = _t.getNextSibling();
						b[count].setshape("triangle");
						}
						break;
					}
					default:
					{
						throw new NoViableAltException(_t);
					}
					}
					}
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				count++;
				_t = __t176;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_overlay:
			{
				AST __t182 = _t;
				AST tmp225_AST_in = (AST)_t;
				match(_t,LITERAL_overlay);
				_t = _t.getFirstChild();
					b[count] = new GECLdatatypes();
									b[count].settype("overlay");
				ovs1 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
					b[count].setname(ovs1.getText());             
								dict.put(ovs1.getText(),count);
				ovs2 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
					if( !(dict.containsKey(ovs2.getText()))) kk.reportError("unrecognized", ovs2.getText());
								else {
						      		dummy=(Integer)dict.get(ovs2.getText()); 
				if(b[dummy].gettype()!="coord")
				kk.reportError("not a coordinate", ovs2.getText());
				else 
				tm[0]=b[dummy];
						    	}         
					        	
				ovs3 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
					if( !(dict.containsKey(ovs3.getText()))) kk.reportError("unrecognized", ovs3.getText());
								else {
						      		dummy=(Integer)dict.get(ovs3.getText()); 
				if(b[dummy].gettype()!="coord")
				kk.reportError("not a coordinate", ovs3.getText());
				else 
						      		tm[1]=b[dummy];
						     	}         
					        	
				ovs4 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
					if( !(dict.containsKey(ovs4.getText()))) kk.reportError("unrecognized", ovs4.getText());
								else {
						      		dummy=(Integer)dict.get(ovs4.getText()); 
				if(b[dummy].gettype()!="coord")
				kk.reportError("not a coordinate", ovs3.getText());
				else 
						      		tm[2]=b[dummy];
						     	}         
					        	
				ovs5 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
					if( !(dict.containsKey(ovs5.getText()))) kk.reportError("unrecognized", ovs5.getText());
								else {
						      		dummy=(Integer)dict.get(ovs5.getText()); 
				if(b[dummy].gettype()!="coord")
				kk.reportError("not a coordinate", ovs5.getText());
				else 
						      		tm[3]=b[dummy];
						     	}   
						 		b[count].setoverlay(tm[0],tm[1],tm[2],tm[3]);    		           
					       	 	
				AST tmp226_AST_in = (AST)_t;
				match(_t,StringConstant);
				_t = _t.getNextSibling();
				b[count].seturl(tmp226_AST_in.getText());
				ovs6 = (AST)_t;
				match(_t,FLOAT);
				_t = _t.getNextSibling();
				ii=Float.parseFloat(ovs6.getText());
									b[count].setrotat(ii); 
									count++;  
								
				_t = __t182;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_persp:
			{
				AST __t183 = _t;
				AST tmp227_AST_in = (AST)_t;
				match(_t,LITERAL_persp);
				_t = _t.getFirstChild();
				pr[countp] = new PerspectType();
				psp1 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				pr[countp].setname(psp1.getText());
				PerspTab.put(psp1.getText(),countp);
				psp2 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				
							if( !(dict.containsKey(psp2.getText()))) kk.reportError("unrecognized", psp2.getText());
						else {
						      dummy=(Integer)dict.get(psp2.getText()); 
				if(b[dummy].gettype()!="coord")
				kk.reportError("not a coordinate", psp2.getText());
				else 
				pr[countp].setcoord(b[dummy]);
						     }         
					
				AST tmp228_AST_in = (AST)_t;
				match(_t,DIST);
				_t = _t.getNextSibling();
					    Distance Mydist = new Distance(tmp228_AST_in.getText());
								pr[countp].setrange( Mydist.getDouble()/0.3048 );
				psp3 = (AST)_t;
				match(_t,FLOAT);
				_t = _t.getNextSibling();
				ii=Float.parseFloat(psp3.getText());
									pr[countp].settilt(ii); 
								
				psp4 = (AST)_t;
				match(_t,FLOAT);
				_t = _t.getNextSibling();
				jj=Float.parseFloat(psp4.getText());
									pr[countp].setheading(jj); 
									countp++;  
								
				_t = __t183;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_line:
			{
				AST __t184 = _t;
				AST tmp229_AST_in = (AST)_t;
				match(_t,LITERAL_line);
				_t = _t.getFirstChild();
				
							 b[count] = new GECLdatatypes();
							 b[count].settype("line");
				ln1 = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				b[count].setname(ln1.getText());             
							dict.put(ln1.getText(),count);
				{
				int _cnt186=0;
				_loop186:
				do {
					if (_t==null) _t=ASTNULL;
					if ((_t.getType()==ID)) {
						AST tmp230_AST_in = (AST)_t;
						match(_t,ID);
						_t = _t.getNextSibling();
						
									if( !(dict.containsKey(tmp230_AST_in.getText()))) kk.reportError("unrecognized", tmp230_AST_in.getText());
						else {
								      dummy=(Integer)dict.get(tmp230_AST_in.getText()); 
						if(b[dummy].gettype()!="coord")
						kk.reportError("not a coordinate", tmp230_AST_in.getText());
						else 
								        b[count].insert(b[dummy]);
								     }         
							
					}
					else {
						if ( _cnt186>=1 ) { break _loop186; } else {throw new NoViableAltException(_t);}
					}
					
					_cnt186++;
				} while (true);
				}
				count++;
				_t = __t184;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_IS:
			{
				AST __t187 = _t;
				AST tmp231_AST_in = (AST)_t;
				match(_t,LITERAL_IS);
				_t = _t.getFirstChild();
				type = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				if( !(dict.containsKey(type.getText()))) kk.reportError("unrecognized", type.getText());
				else {
				dummy=(Integer)dict.get(type.getText());
				if(b[dummy].gettype()!="coord" && b[dummy].gettype()!="distance" && b[dummy].gettype()!="struct")
				kk.reportError("invalid statement", "IS");
				else if(((b[dummy].gettype()).toString()).equals("distance")) {
				AST ast = type.getNextSibling();
				String dstnc = ast.toString();
				if(!(dict.containsKey(ast.getText()))) kk.reportError("unrecognized", ast.getText());
				int dumm = (Integer)dict.get(ast.getText());
				if(b[dumm].gettype()!="distance") kk.reportError("invalid statement", "IS");
				dstnc = b[dumm].getdists();
				sep_dist = new Distance(dstnc);
				int IntValue=0;
				double tmpdouble=0.0;
				float FloValue=0.0f;
				if((ast.getNextSibling()).getNextSibling().getType()==DIST){
				dstnc = ((ast.getNextSibling()).getNextSibling()).toString();                            	
					Distance new_dist = new Distance(dstnc);               
					tmpdouble= new_dist.getDouble(); // get meter
					FloValue = (float)tmpdouble;
				
					}else if ((ast.getNextSibling()).getNextSibling().getType()==INTEGER){
						dstnc = ((ast.getNextSibling()).getNextSibling()).toString();
					IntValue = Integer.parseInt(dstnc);
				
					}                      
				//  dstnc = ((ast.getNextSibling()).getNextSibling()).toString();
				//   int value = Integer.parseInt(dstnc);
				if(((ast.getNextSibling()).toString()).equals("*")) {
				dd = sep_dist.getDouble() * IntValue / 0.3048;
				dstnc = Double.toString(dd) + "ft";
				b[dummy].setdists(dstnc);
				System.err.println("scqwcqwceqc " + dstnc + "  " + dummy + "   " + b[dummy].getdists());
				}
				else {
				dd = (sep_dist.getDouble() + FloValue) / 0.3048;
				dstnc = Double.toString(dd) + "ft";
				b[dummy].setdists(dstnc);
				System.err.println("scqwcqwceqc " + dstnc + "  " + dummy + "   " + b[dummy].getdists());
				}
				}else if(((b[dummy].gettype()).toString()).equals("coord"))
				{
					
					System.out.println("Debug!! ");
					float setdist=0.0f ;
					int setdir=0;
				// get first ID	
					AST ast = type.getNextSibling();
				String dstnc = ast.toString();
				if(!(dict.containsKey(ast.getText()))) kk.reportError("unrecognized", ast.getText());
				int dumm = (Integer)dict.get(ast.getText());
				System.out.println("Debug!! 1 long = "+b[dumm].gettype());
				if(!b[dumm].gettype().equals("coord")) kk.reportError("invalid statement", "IS");
					boolean IsPlus = false;
					if(((ast.getNextSibling()).toString()).equals("+")) {
				IsPlus = true; 
				}
				else {
				kk.reportError("invalid operator", "*");
				}
				// get first parameter suppose a dist ID or number   
				AST ast1 = (ast.getNextSibling()).getNextSibling();
				System.out.println("Debug!! 1.5 type = "+ast1.getType());  
				if(ast1.getType()==ID){
				// get a dist ID    	
				dstnc = ast1.toString();
				if(!(dict.containsKey(ast1.getText()))) kk.reportError("unrecognized", ast1.getText());
				int dummdist = (Integer)dict.get(ast1.getText());
				System.out.println("Debug!! 2 long = "+b[dummdist].gettype());
				if(b[dummdist].gettype()!="distance") kk.reportError("invalid statement", "IS");
											sep_dist = new Distance(b[dummdist].getdists());
											setdist = (float)(sep_dist.getDouble()/ 0.3048);
											
											
											}else if(ast1.getType()==DIST){
										// get a dist number	
											sep_dist = new Distance(ast1.getText());
											setdist = (float)(sep_dist.getDouble()/ 0.3048);
											
											}
										                    
				// get second parameter suppose a direction         
				AST ast2 = ast1.getNextSibling();
				System.out.println("Debug!! 2.5 type = "+ast2.getType());  
				if(ast2.getType()==ID){
				// get a dir ID    	
				dstnc = ast2.toString();
				if(!(dict.containsKey(ast2.getText()))) kk.reportError("unrecognized", ast2.getText());
				int dummdir = (Integer)dict.get(ast2.getText());
				System.out.println("Debug!! 3 type = "+b[dummdir].gettype());  
				if(b[dummdir].gettype()!="int") kk.reportError("invalid statement", "IS");
											setdir = b[dummdir].getIntValue();					
											}else if(ast2.getType()==INTEGER){
										// get a dir number	
											setdir = Integer.parseInt(ast2.getText());
											}
				
				
				System.out.println("setdist = "+setdist);   
				b[dummy].navigate(b[dumm].getlon(),b[dumm].getlat(),setdist,setdir);   
					 System.out.println("Debug!! long = "+b[dummy].getlon()+"lat = "+b[dummy].getlat());
					
				}else
				{   System.err.println("dcrv");}
				}
				
				_t = __t187;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_printk:
			{
				AST __t188 = _t;
				AST tmp232_AST_in = (AST)_t;
				match(_t,LITERAL_printk);
				_t = _t.getFirstChild();
				AST tmp233_AST_in = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				
						if( !(dict.containsKey(tmp233_AST_in.getText()))) kk.reportError("unrecognized: ",tmp233_AST_in.getText());
						else {dummy=(Integer)dict.get(tmp233_AST_in.getText()); System.out.println("printk find index = "+dummy +"  type = "+b[dummy].getname()); }         
						if(b[dummy].gettype() == "distance") kk.printdis(b[dummy].getdists());
						if(b[dummy].gettype() == "coord") kk.printcoord(b[dummy]);
						if(b[dummy].gettype() == "point") kk.printPoint(b[dummy]);
						if(b[dummy].gettype() == "place") kk.printPlace(b[dummy]);
						if(b[dummy].gettype() == "struct"){ 
						if(b[dummy].getshape() == "square") kk.printquadrangle(b[dummy]);
						if(b[dummy].getshape() == "rectangle") kk.printquadrangle(b[dummy]);
						if(b[dummy].getshape() == "triangle") /*{ tm.settriangle(b[dummy]);kk.printtriangle(b[dummy]);}*/;
						}
						if(b[dummy].gettype() == "overlay") kk.printOverlay(b[dummy]);
						if(b[dummy].gettype() == "line") kk.printLine(b[dummy]);
							if(b[dummy].gettype() == "read3Dfile") b[dummy].read3Dfile.renderKML(kk.outp);
					
				_t = __t188;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_int:
			{
				AST __t189 = _t;
				AST tmp234_AST_in = (AST)_t;
				match(_t,LITERAL_int);
				_t = _t.getFirstChild();
				
							 b[count] = new GECLdatatypes();
							 b[count].settype("int");
				AST tmp235_AST_in = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				b[count].setname(tmp235_AST_in.getText());             
						dict.put(tmp235_AST_in.getText(),count);
				i1 = (AST)_t;
				match(_t,INTEGER);
				_t = _t.getNextSibling();
				
									tempi1=Integer.parseInt(i1.getText());
					                b[count].setIntValue(tempi1);      
					                 count++;  
					
				_t = __t189;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_float:
			{
				AST __t190 = _t;
				AST tmp236_AST_in = (AST)_t;
				match(_t,LITERAL_float);
				_t = _t.getFirstChild();
				
							 b[count] = new GECLdatatypes();
							 b[count].settype("float");
				AST tmp237_AST_in = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				b[count].setname(tmp237_AST_in.getText());             
						dict.put(tmp237_AST_in.getText(),count);
				f21 = (AST)_t;
				match(_t,FLOAT);
				_t = _t.getNextSibling();
				
									tempf1=Float.parseFloat(f21.getText());
					                b[count].setFloatValue(tempf1);      
					                 count++;  
					
				_t = __t190;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_readfile:
			{
				AST __t191 = _t;
				AST tmp238_AST_in = (AST)_t;
				match(_t,LITERAL_readfile);
				_t = _t.getFirstChild();
				
							 b[count] = new GECLdatatypes();
							 b[count].settype("read3Dfile");
							
				AST tmp239_AST_in = (AST)_t;
				match(_t,ID);
				_t = _t.getNextSibling();
				b[count].setname(tmp239_AST_in.getText());             
						dict.put(tmp239_AST_in.getText(),count);
							
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case FLOAT:
				{
					scale1 = (AST)_t;
					match(_t,FLOAT);
					_t = _t.getNextSibling();
					
							b[count].read3Dfile.scale = Float.parseFloat(scale1.getText());
						
					break;
				}
				case ID:
				{
					AST tmp240_AST_in = (AST)_t;
					match(_t,ID);
					_t = _t.getNextSibling();
					
							tempi1 = (Integer)dict.get(tmp240_AST_in.getText());
							b[count].read3Dfile.scale = b[tempi1].getFloatValue();
							
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case FLOAT:
				{
					translate_x1 = (AST)_t;
					match(_t,FLOAT);
					_t = _t.getNextSibling();
					
							b[count].read3Dfile.translate_x = Float.parseFloat(translate_x1.getText());
						
					break;
				}
				case ID:
				{
					AST tmp241_AST_in = (AST)_t;
					match(_t,ID);
					_t = _t.getNextSibling();
					
							tempi1 = (Integer)dict.get(tmp241_AST_in.getText());
							b[count].read3Dfile.translate_x = b[tempi1].getFloatValue();
							
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case FLOAT:
				{
					translate_y1 = (AST)_t;
					match(_t,FLOAT);
					_t = _t.getNextSibling();
					
							b[count].read3Dfile.translate_y = Float.parseFloat(translate_y1.getText());
						
					break;
				}
				case ID:
				{
					AST tmp242_AST_in = (AST)_t;
					match(_t,ID);
					_t = _t.getNextSibling();
					
							tempi1 = (Integer)dict.get(tmp242_AST_in.getText());
							b[count].read3Dfile.translate_y = b[tempi1].getFloatValue();
							
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case FLOAT:
				{
					translate_z1 = (AST)_t;
					match(_t,FLOAT);
					_t = _t.getNextSibling();
					
							b[count].read3Dfile.translate_z = Float.parseFloat(translate_z1.getText());
						
					break;
				}
				case ID:
				{
					AST tmp243_AST_in = (AST)_t;
					match(_t,ID);
					_t = _t.getNextSibling();
					
							tempi1 = (Integer)dict.get(tmp243_AST_in.getText());
							b[count].read3Dfile.translate_z = b[tempi1].getFloatValue();
							
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				st21 = (AST)_t;
				match(_t,StringConstant);
				_t = _t.getNextSibling();
				
									b[count].read3Dfile.openfile(st21.getText());
					                 count++;  
					
				_t = __t191;
				_t = _t.getNextSibling();
				break;
			}
			case SEMI:
			case NStatementExpr:
			case LITERAL_while:
			case LITERAL_do:
			case LITERAL_continue:
			case LITERAL_break:
			case LITERAL_return:
			case LITERAL_if:
			{
				statement(_t);
				_t = _retTree;
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
		return dummy;
	}
	
	public final void statement(AST _t) throws RecognitionException {
		
		AST statement_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		AST s = null;
		AST w = null;
		AST exp1 = null;
		AST block1 = null;
		AST d = null;
		AST block2 = null;
		AST exp2 = null;
		AST r = null;
		
			float exprReturn = 0; 
			float ii = 0.0f;
			float jj = 0.0f;
			float kf = 0.0f;
			double dd = 0;
			AST e1, e2, e3, as2, as3;
			int dummy = 0;
		
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case SEMI:
			{
				s = (AST)_t;
				match(_t,SEMI);
				_t = _t.getNextSibling();
				break;
			}
			case NStatementExpr:
			{
				AST __t197 = _t;
				AST tmp244_AST_in = (AST)_t;
				match(_t,NStatementExpr);
				_t = _t.getFirstChild();
				exprReturn=expr(_t);
				_t = _retTree;
				_t = __t197;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_while:
			{
				AST __t198 = _t;
				w = _t==ASTNULL ? null :(AST)_t;
				match(_t,LITERAL_while);
				_t = _t.getFirstChild();
				if_break = 0; if_skip_rcurly = 0;
				exp1 = _t==ASTNULL ? null : (AST)_t;
				exprReturn=expr(_t);
				_t = _retTree;
				{
				if (_t==null) _t=ASTNULL;
				if (((_tokenSet_1.member(_t.getType())))&&( exprReturn > 0 )) {
					block1 = _t==ASTNULL ? null : (AST)_t;
					block_statement(_t);
					_t = _retTree;
							
													if(if_break == 1)
														if_break = 0;
													else
													{
													
														while( recursive_f(exp1) > 0)
														{
															e1 = (AST) w.getFirstChild(); //expr
															e1 = (AST) e1.getNextSibling(); // {
															e1 = (AST) e1.getNextSibling(); // first statement now
															while(true) 
															{
																if(e1.getText().length()>0)
																{
																	if(e1.getText().equals("break"))
																	{
																		if_break = 1;
																		break;
																	}
																	else if(e1.getText().equals("if"))
																	{
																		System.out.println("inside while loop and if");
																		e2 = (AST) e1.getFirstChild(); // expr => ==, ||, &&, != .......
																		System.out.println("first child node is " + e2.getText());
																		e3 = (AST) e2.getNextSibling(); // {
																		System.out.println("next node is " + e3.getText());
																		e3 = (AST) e3.getNextSibling(); // block statement
																		System.out.println("next node is " + e3.getText());
																		int tempi1 = (int) recursive_f(e2);
																		if(tempi1 > 0) // execut this block
																		{
																			System.out.println("execut this block");
																			while(!e3.getText().equals("}"))
																			{
																				recursive_f(e3);
																				e3 = (AST) e3.getNextSibling();
																				System.out.println("next node is " + e3.getText());
																			}
																		}
																		else
																		{
																			//skip first block
																			System.out.println("skip first block");
																			while(!e3.getText().equals("}"))
																			{
																				e3 = (AST) e3.getNextSibling();
																			}
																			e3 = (AST) e3.getNextSibling(); //check "else"
									
																			System.out.println("check else");
																			if(e3 != null) //this is else
																			{
																				System.out.println("this is else inside");
																				e3 = (AST) e3.getNextSibling(); // "{"
																				e3 = (AST) e3.getNextSibling(); // statement block
																				while(!e3.getText().equals("}"))
																				{
																					recursive_f(e3);
																					e3 = (AST) e3.getNextSibling();
																				}
																			}
																		}
																		if(if_break == 1 || if_continue == 1)
																		{
																			break;
																		}
																	}
																	else if(e1.getText().equals("continue") || e1.getText().equals("}"))
																	{
																		break;
																	}
																	else if(e1.getText().equals("dist"))
																	{
																		//dist
																		b[count] = new GECLdatatypes();
																		b[count].settype("distance");
																		//ID	
																		e2 = e1.getFirstChild();
																		b[count].setname(e1.getText());             
																		dict.put(e2.getText(),count);
																		//(DIST )?
																		e2 = e2.getNextSibling();
																		if(e2!=null)
																		b[count].setdists( e2.getText());
																		count++;
																	}
																	else if(e1.getText().equals("coord"))
																	{
																		//coord
																		b[count] = new GECLdatatypes();
																		b[count].settype("coord");
																		//ID
																		e2 = e1.getFirstChild();
																		b[count].setname(e2.getText());             
																		dict.put(e2.getText(),count);
																		b[count].setcoord( ii,jj,"0ft");
																	
																		//FLOAT | (MINUS FLOAT)
																		e2 = e2.getNextSibling();
																	
																		if(e2 == null) //finished, there is no assign value here
																		{
																		}
																		else // assign value
																		{
																			if(e2.getText().equals("-")) //MINUS FLOAT case
																			{
																				e2 = e2.getNextSibling();
																				ii=Float.parseFloat(e2.getText()); 
																				ii=0-ii;
																			}
																			else //FLOAT
																			{
																				e2 = e2.getNextSibling();
																				ii=Float.parseFloat(e2.getText());
																			}
																		
																			//FLOAT | (MINUS FLOAT)
																			e2 = e2.getNextSibling();
																			if(e2.getText().equals("-")) //MINUS FLOAT case
																			{
																				e2 = e2.getNextSibling();
																				jj=Float.parseFloat(e2.getText()); 
																				jj=0-jj;
																			}
																			else //FLOAT
																			{
																				e2 = e2.getNextSibling();
																				jj=Float.parseFloat(e2.getText());
																			}
																			//DIST
																			e2 = e2.getNextSibling();
																			b[count].setcoord( ii,jj, e2.getText());
																		}
																		count++;
																	}
																	else if(e1.getText().equals("AsigCity"))
																	{
																		//as1:ID
																		e2 = e1.getFirstChild();
																		if(!(dict.containsKey(e2.getText())))
																		{													
																			kk.reportError("not a valid city", e2.getText());
																		}
																		else
																		{													
																			dummy=(Integer)dict.get(e2.getText());
																			
																			//as2:StringConstant
																			e2 = e2.getNextSibling();
																			as2 = e2;
																		
																			//as3:StringConstant
																			e2 = e2.getNextSibling();
																			as3 = e2;
																		
																			WorldCoords tmp=kk.getCityCoords(as2.getText(), as3.getText());
																			b[dummy].setCityCoords(tmp);
																		}
																	}
																	else if(e1.getText().equals("point"))
																	{
																		//point
																		b[count] = new GECLdatatypes();
																		b[count].settype("point");
																		//s1:ID	
																		e2 = e1.getFirstChild();
																		b[count].setname(e2.getText());             
																		dict.put(e2.getText(),count);
																		//s2:ID
																		e2 = e2.getNextSibling();
																		if(!(dict.containsKey(e2.getText()))) 
																			kk.reportError("unrecognized", e2.getText());
																		else 
																		{
																			dummy=(Integer)dict.get(e2.getText());
																			if(b[dummy].gettype()!="coord")
																				kk.reportError("not a coordinate", e2.getText());
																			else 
																				b[count].cpy(b[dummy]);
																		}
																		count++;
																	}
																	else if(e1.getText().equals("place"))
																	{
																		//place
																		b[count] = new GECLdatatypes();
																		b[count].settype("place");
																		//s3:ID
																		e2 = e1.getFirstChild();
																		b[count].setname(e2.getText());             
																		dict.put(e2.getText(),count);
																		//s4:ID
																		e2 = e2.getNextSibling();
																		if(!(dict.containsKey(e2.getText()))) 
																			kk.reportError("unrecognized", e2.getText());
																		else 
																		{
																			dummy=(Integer)dict.get(e2.getText()); 
																			if(b[dummy].gettype()!="point")
																				kk.reportError("not a point", e2.getText());
																			else 
																				b[count].cpy(b[dummy]);
																		}
																		//s5:StringConstant
																		e2 = e2.getNextSibling();
																		b[count].settitle(e2.getText());
																		// (pla1:ID)?
																		e2 = e2.getNextSibling();
																		if(e2 == null)
																		{
																		}
																		else
																		{
																			if(!(PerspTab.containsKey(e2.getText()))) 
																				kk.reportError("unrecognized", e2.getText());
																			else 
																			{
																				dummy=(Integer)PerspTab.get(e2.getText()); 
																				b[count].setpersp(pr[dummy]);
																			}	
																		}
																		count++;
																	}
																	else if(e1.getText().equals("struct"))
																	{
																		//struct
																		b[count] = new GECLdatatypes();
																		b[count].settype("struct");
																		//s6:ID
																		e2 = e1.getFirstChild();
																		b[count].setname(e2.getText());             
																		dict.put(e2.getText(),count);
																		//( shape ID )?
																		e2 = e2.getNextSibling();
																		if(e2==null)
																		{
																		}
																		else
																		{
																			if(e2.getText().equals("square"))
																			{
																				b[count].setshape("square");
																				//f3:FLOAT
																				e2 = e2.getNextSibling();
																				ii=Float.parseFloat(e2.getText());
																				//f4:FLOAT
																				e2 = e2.getNextSibling();
																				jj=Float.parseFloat(e2.getText());
																				//s7:ID
																				e2 = e2.getNextSibling();
																				if(!(dict.containsKey(e2.getText()))) 
																				{
																					kk.reportError("unrecognized: " , e2.getText());
																				}
																				else
																				{
																					dummy=(Integer)dict.get(e2.getText()); 
																					b[count].cpy(b[dummy]);
																				}
																				b[count].setsquare(ii,jj);			
																			}
																			else if(e2.getText().equals("rectangle"))
																			{
																				b[count].setshape("rectangle");
																				//f5:FLOAT
																				e2 = e2.getNextSibling();
																				ii=Float.parseFloat(e2.getText());
																				//f6:FLOAT
																				e2 = e2.getNextSibling();
																				jj=Float.parseFloat(e2.getText());
																				//f7:FLOAT
																				e2 = e2.getNextSibling();
																				kf=Float.parseFloat(e2.getText());
																				//s8:ID
																				e2 = e2.getNextSibling();
																				if( !(dict.containsKey(e2.getText()))) 
																				{
																					kk.reportError("unrecognized: ", e2.getText());
																				}
																				else 
																				{
																					dummy=(Integer)dict.get(e2.getText()); 
																					b[count].cpy(b[dummy]);
																				}
																				b[count].setrect(ii,jj,kf);
																			}
																			else if(e2.getText().equals("triangle"))
																			{
																				b[count].setshape("triangle");
																			}
																			count++;
																		}
																	}
																	else if(e1.getText().equals("overlay"))
																	{
						//overlay
						b[count] = new GECLdatatypes();
						b[count].settype("overlay");
						
						//ovs1:ID
						e2 = e1.getFirstChild();
						b[count].setname(e2.getText());             
					dict.put(e2.getText(),count);
						
						//ovs2:ID
						e2 = e2.getNextSibling();
						if( !(dict.containsKey(e2.getText()))) 
							kk.reportError("unrecognized", e2.getText());
					else 
						{
						dummy=(Integer)dict.get(e2.getText()); 
					if(b[dummy].gettype()!="coord")
					kk.reportError("not a coordinate", e2.getText());
					else 
					tm[0]=b[dummy];
					}
						
						//ovs3:ID
						e2 = e2.getNextSibling();
						if( !(dict.containsKey(e2.getText()))) 
							kk.reportError("unrecognized", e2.getText());
					else 
						{
						dummy=(Integer)dict.get(e2.getText()); 
					if(b[dummy].gettype()!="coord")
					kk.reportError("not a coordinate", e2.getText());
					else 
							tm[1]=b[dummy];
					}
						
						//ovs4:ID
						e2 = e2.getNextSibling();
						if( !(dict.containsKey(e2.getText()))) 
							kk.reportError("unrecognized", e2.getText());
					else 
						{
						dummy=(Integer)dict.get(e2.getText()); 
					if(b[dummy].gettype()!="coord")
					kk.reportError("not a coordinate", e2.getText());
					else 
							tm[2]=b[dummy];
					}
						
						//ovs5:ID
						e2 = e2.getNextSibling();
						if( !(dict.containsKey(e2.getText()))) 
							kk.reportError("unrecognized", e2.getText());
						else 
						{
							dummy=(Integer)dict.get(e2.getText()); 
					if(b[dummy].gettype()!="coord")
					kk.reportError("not a coordinate", e2.getText());
					else 
						tm[3]=b[dummy];
					}   
					b[count].setoverlay(tm[0],tm[1],tm[2],tm[3]);
										
						//StringConstant
						e2 = e2.getNextSibling();
						b[count].seturl(e2.getText());
						
						//ovs6:FLOAT
						e2 = e2.getNextSibling();
						ii=Float.parseFloat(e2.getText());
						b[count].setrotat(ii); 
						count++;
					}
					else if(e1.getText().equals("persp"))
					{
						//persp
						pr[countp] = new PerspectType(); 
						
						//psp1:ID
						e2 = e1.getFirstChild();
						pr[countp].setname(e2.getText());
					PerspTab.put(e2.getText(),countp);
						
						//psp2:ID
						e2 = e2.getNextSibling();
						if( !(dict.containsKey(e2.getText()))) 
							kk.reportError("unrecognized", e2.getText());
					else 
						{
					dummy=(Integer)dict.get(e2.getText()); 
					if(b[dummy].gettype()!="coord")
					kk.reportError("not a coordinate", e2.getText());
					else 
					pr[countp].setcoord(b[dummy]);
					}
						
						//DIST
						e2 = e2.getNextSibling();
						Distance Mydist = new Distance(e2.getText());
						pr[countp].setrange( Mydist.getDouble()/0.3048 );
						
						//psp3:FLOAT
						e2 = e2.getNextSibling();
						ii=Float.parseFloat(e2.getText());
						pr[countp].settilt(ii);
						
						//psp4:FLOAT
						e2 = e2.getNextSibling();
						jj=Float.parseFloat(e2.getText());
						pr[countp].setheading(jj); 
						countp++;
					}
					else if(e1.getText().equals("line"))
					{
						//line
						b[count] = new GECLdatatypes();
						b[count].settype("line");
						
						//ln1:ID
						e2 = e1.getFirstChild();
						b[count].setname(e2.getText());             
					dict.put(e2.getText(),count);
						
						// ( ID )+
						e2 = e2.getNextSibling();
						while(e2 != null)
						{
							if( !(dict.containsKey(e2.getText())))
								kk.reportError("unrecognized", e2.getText());
					else 
							{
						    dummy=(Integer)dict.get(e2.getText()); 
					if(b[dummy].gettype()!="coord")
					kk.reportError("not a coordinate", e2.getText());
					else 
									b[count].insert(b[dummy]);
							}
							e2 = e2.getNextSibling();
						}
						count++;
						
					}
					
					else if(e1.getText().equals("IS"))
					{
						//IS, type:ID
						e2 = e1.getFirstChild();
						
						if( !(dict.containsKey(e2.getText()))) 
							kk.reportError("unrecognized", e2.getText());
					else {
					dummy=(Integer)dict.get(e2.getText());
					if(b[dummy].gettype()!="coord" && b[dummy].gettype()!="distance" && b[dummy].gettype()!="struct")
					kk.reportError("invalid statement", "IS");
					else if(((b[dummy].gettype()).toString()).equals("distance")) {
					AST ast = e2.getNextSibling();
					String dstnc = ast.toString();
					if(!(dict.containsKey(ast.getText()))) kk.reportError("unrecognized", ast.getText());
					int dumm = (Integer)dict.get(ast.getText());
					if(b[dumm].gettype()!="distance") kk.reportError("invalid statement", "IS");
					dstnc = b[dumm].getdists();
					sep_dist = new Distance(dstnc);
					int IntValue=0;
					double tmpdouble=0.0;
					float FloValue=0.0f;
					if((ast.getNextSibling()).getNextSibling().getType()==DIST){
					dstnc = ((ast.getNextSibling()).getNextSibling()).toString();                            	
						Distance new_dist = new Distance(dstnc);               
						tmpdouble= new_dist.getDouble(); // get meter
						FloValue = (float)tmpdouble;
					
						}else if ((ast.getNextSibling()).getNextSibling().getType()==INTEGER){
							dstnc = ((ast.getNextSibling()).getNextSibling()).toString();
						IntValue = Integer.parseInt(dstnc);
					
						}                      
					//  dstnc = ((ast.getNextSibling()).getNextSibling()).toString();
					//   int value = Integer.parseInt(dstnc);
					if(((ast.getNextSibling()).toString()).equals("*")) {
					dd = sep_dist.getDouble() * IntValue / 0.3048;
					dstnc = Double.toString(dd) + "ft";
					b[dummy].setdists(dstnc);
					System.err.println("scqwcqwceqc " + dstnc + "  " + dummy + "   " + b[dummy].getdists());
					}
					else {
					dd = (sep_dist.getDouble() + FloValue) / 0.3048;
					dstnc = Double.toString(dd) + "ft";
					b[dummy].setdists(dstnc);
					System.err.println("scqwcqwceqc " + dstnc + "  " + dummy + "   " + b[dummy].getdists());
					}
					}else if(((b[dummy].gettype()).toString()).equals("coord"))
					{
						
						System.out.println("Debug!! ");
						float setdist=0.0f ;
						int setdir=0;
					// get first ID	
						AST ast = e2.getNextSibling();
					String dstnc = ast.toString();
					if(!(dict.containsKey(ast.getText()))) kk.reportError("unrecognized", ast.getText());
					int dumm = (Integer)dict.get(ast.getText());
					System.out.println("Debug!! 1 long = "+b[dumm].gettype());
					if(!b[dumm].gettype().equals("coord")) kk.reportError("invalid statement", "IS");
						boolean IsPlus = false;
						if(((ast.getNextSibling()).toString()).equals("+")) {
					IsPlus = true; 
					}
					else {
					kk.reportError("invalid operator", "*");
					}
					// get first parameter suppose a dist ID or number   
					AST ast1 = (ast.getNextSibling()).getNextSibling();
					System.out.println("Debug!! 1.5 type = "+ast1.getType());  
					if(ast1.getType()==ID){
					// get a dist ID    	
					dstnc = ast1.toString();
					if(!(dict.containsKey(ast1.getText()))) kk.reportError("unrecognized", ast1.getText());
					int dummdist = (Integer)dict.get(ast1.getText());
					System.out.println("Debug!! 2 long = "+b[dummdist].gettype());
					if(b[dummdist].gettype()!="distance") kk.reportError("invalid statement", "IS");
												sep_dist = new Distance(b[dummdist].getdists());
												setdist = (float)(sep_dist.getDouble()/ 0.3048);
												
												
												}else if(ast1.getType()==DIST){
											// get a dist number	
												sep_dist = new Distance(ast1.getText());
												setdist = (float)(sep_dist.getDouble()/ 0.3048);
												
												}
											                    
					// get second parameter suppose a direction         
					AST ast2 = ast1.getNextSibling();
					System.out.println("Debug!! 2.5 type = "+ast2.getType());  
					if(ast2.getType()==ID){
					// get a dir ID    	
					dstnc = ast2.toString();
					if(!(dict.containsKey(ast2.getText()))) kk.reportError("unrecognized", ast2.getText());
					int dummdir = (Integer)dict.get(ast2.getText());
					System.out.println("Debug!! 3 type = "+b[dummdir].gettype());  
					if(b[dummdir].gettype()!="int") kk.reportError("invalid statement", "IS");
												setdir = b[dummdir].getIntValue();					
												}else if(ast2.getType()==INTEGER){
											// get a dir number	
												setdir = Integer.parseInt(ast2.getText());
												}
					
					
					System.out.println("setdist = "+setdist);   
					b[dummy].navigate(b[dumm].getlon(),b[dumm].getlat(),setdist,setdir);   
						 System.out.println("Debug!! long = "+b[dummy].getlon()+"lat = "+b[dummy].getlat());
						
					}else
					{   System.err.println("dcrv");}
					}	
					}
					else if(e1.getText().equals("printk"))
					{
						//printk, ID
						
						e2 = e1.getFirstChild();
						if( !(dict.containsKey(e2.getText()))) 
							kk.reportError( "unrecognized: ", e2.getText() );
					else { 
							dummy = (Integer)dict.get(e2.getText()); 
							System.out.println("printk find index = "+dummy +"  type = "+b[dummy].getname());
						}
						
					if(b[dummy].gettype() == "distance") 
							kk.printdis(b[dummy].getdists());
					if(b[dummy].gettype() == "coord") 
							kk.printcoord(b[dummy]);
					if(b[dummy].gettype() == "point") 
							kk.printPoint(b[dummy]);
					if(b[dummy].gettype() == "place") 
							kk.printPlace(b[dummy]);
					if(b[dummy].gettype() == "struct")
						{ 
						if(b[dummy].getshape() == "square") 
								kk.printquadrangle(b[dummy]);
						if(b[dummy].getshape() == "rectangle") 
								kk.printquadrangle(b[dummy]);
						if(b[dummy].getshape() == "triangle") ;
					}
					if(b[dummy].gettype() == "overlay") 
							kk.printOverlay(b[dummy]);
					if(b[dummy].gettype() == "line") 
							kk.printLine(b[dummy]);
						if(b[dummy].gettype() == "read3Dfile") 
							b[dummy].read3Dfile.renderKML(kk.outp);
						
					}
					else if(e1.getText().equals("readfile"))
					{
						//readfile
						b[count] = new GECLdatatypes();
						b[count].settype("read3Dfile");
						
						//ovs1:ID
						e2 = e1.getFirstChild();
						b[count].setname(e2.getText());             
					dict.put(e2.getText(),count);
						
						//scale1:FLOAT
						e2 = e2.getNextSibling();
						if( !(dict.containsKey(e2.getText()))) 
							b[count].read3Dfile.scale = Float.parseFloat(e2.getText());
					else { 
							dummy = (Integer)dict.get(e2.getText()); 
							b[count].read3Dfile.scale = b[dummy].getFloatValue();
						} 
						
						//translate_x1:FLOAT
						e2 = e2.getNextSibling();
						if( !(dict.containsKey(e2.getText()))) 
							b[count].read3Dfile.translate_x = Float.parseFloat(e2.getText());
					else { 
							dummy = (Integer)dict.get(e2.getText()); 
							b[count].read3Dfile.translate_x = b[dummy].getFloatValue();
						}
						
						//translate_y1:FLOAT
						e2 = e2.getNextSibling();
						if( !(dict.containsKey(e2.getText()))) 
							b[count].read3Dfile.translate_y = Float.parseFloat(e2.getText());
					else { 
							dummy = (Integer)dict.get(e2.getText()); 
							b[count].read3Dfile.translate_y = b[dummy].getFloatValue();
						}
						
						//translate_z1:FLOAT
						e2 = e2.getNextSibling();
						if( !(dict.containsKey(e2.getText()))) 
							b[count].read3Dfile.translate_z = Float.parseFloat(e2.getText());
					else { 
							dummy = (Integer)dict.get(e2.getText()); 
							b[count].read3Dfile.translate_z = b[dummy].getFloatValue();
						}
						
						//filename
						e2 = e2.getNextSibling();
						b[count].read3Dfile.openfile(e2.getText());
						count++;  
					
					}
					
					
					
					
					
					
					
																	
																}											
																recursive_f(e1.getFirstChild());
																e1 = (AST) e1.getNextSibling();
																System.out.println( "inside while loop" );
															}
															if(if_break == 1)
															{
																if_break = 0;
																break;
															}
															if_continue = 0;
														}
													}
												
				}
				else if ((_tokenSet_2.member(_t.getType()))) {
					skip_block_statement(_t);
					_t = _retTree;
				}
				else {
					throw new NoViableAltException(_t);
				}
				
				}
				_t = __t198;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_do:
			{
				AST __t200 = _t;
				d = _t==ASTNULL ? null :(AST)_t;
				match(_t,LITERAL_do);
				_t = _t.getFirstChild();
				System.out.println( "after do" ); if_break = 0; if_skip_rcurly = 0;
				block2 = _t==ASTNULL ? null : (AST)_t;
				block_statement(_t);
				_t = _retTree;
				System.out.println( "after block statement if_break " + if_break );
				AST tmp245_AST_in = (AST)_t;
				match(_t,LITERAL_while);
				_t = _t.getNextSibling();
				System.out.println( "after while" );
				exp2 = _t==ASTNULL ? null : (AST)_t;
				exprReturn=expr(_t);
				_t = _retTree;
				
												System.out.println( "after expr" );
												
												if(if_break == 1)
												{
													System.out.println( "if_break is 1" );
													if_break = 0;
												}
												else
												{
													while( exprReturn > 0)
													{
														e1 = (AST) d.getFirstChild(); //{
														e1 = (AST) e1.getNextSibling(); // first statement now
														while(true) 
														{
															if(e1.getText().length()>0)
															{
																if(e1.getText().equals("break"))
																{
																	if_break = 1;
																	break;
																}
																else if(e1.getText().equals("continue") || e1.getText().equals("}"))
																{
																	break;
																}												
															}											
															recursive_f(e1.getFirstChild());
															e1 = (AST) e1.getNextSibling();
															System.out.println( "inside while loop" );
														}
														if(if_break == 1)
														{
															if_break = 0;
															break;
														}
														exprReturn = recursive_f(exp2);
														
													}
												}
												
											
				_t = __t200;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_continue:
			{
				AST tmp246_AST_in = (AST)_t;
				match(_t,LITERAL_continue);
				_t = _t.getNextSibling();
				if_skip_rcurly = 1 ;
				break;
			}
			case LITERAL_break:
			{
				AST tmp247_AST_in = (AST)_t;
				match(_t,LITERAL_break);
				_t = _t.getNextSibling();
				if_break = 1 ; if_skip_rcurly = 1; System.out.println( "set if_break " + if_break);
				break;
			}
			case LITERAL_return:
			{
				AST __t201 = _t;
				r = _t==ASTNULL ? null :(AST)_t;
				match(_t,LITERAL_return);
				_t = _t.getFirstChild();
				System.out.println( r );
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case ASSIGN:
				case MOD:
				case DEC:
				case MOD_ASSIGN:
				case LTE:
				case PLUS:
				case LOR:
				case PLUS_ASSIGN:
				case EQUAL:
				case NOT_EQUAL:
				case MINUS:
				case LAND:
				case MINUS_ASSIGN:
				case GT:
				case STAR:
				case STAR_ASSIGN:
				case LT:
				case DIV:
				case INC:
				case DIV_ASSIGN:
				case GTE:
				case NEmptyExpression:
				case NCommaExpr:
				case RSHIFT_ASSIGN:
				case LSHIFT_ASSIGN:
				case BAND_ASSIGN:
				case BOR_ASSIGN:
				case BXOR_ASSIGN:
				case BOR:
				case BXOR:
				case BAND:
				case LSHIFT:
				case RSHIFT:
				{
					exprReturn=expr(_t);
					_t = _retTree;
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				System.out.println( ";" );
				_t = __t201;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_if:
			{
				AST __t203 = _t;
				AST tmp248_AST_in = (AST)_t;
				match(_t,LITERAL_if);
				_t = _t.getFirstChild();
				exprReturn=expr(_t);
				_t = _retTree;
				{
				if (_t==null) _t=ASTNULL;
				if (((_tokenSet_1.member(_t.getType())))&&( exprReturn > 0 )) {
					block_statement(_t);
					_t = _retTree;
					{
					if (_t==null) _t=ASTNULL;
					switch ( _t.getType()) {
					case LITERAL_else:
					{
						AST tmp249_AST_in = (AST)_t;
						match(_t,LITERAL_else);
						_t = _t.getNextSibling();
						skip_block_statement(_t);
						_t = _retTree;
						break;
					}
					case 3:
					{
						break;
					}
					default:
					{
						throw new NoViableAltException(_t);
					}
					}
					}
				}
				else if ((_tokenSet_2.member(_t.getType()))) {
					skip_block_statement(_t);
					_t = _retTree;
					{
					if (_t==null) _t=ASTNULL;
					switch ( _t.getType()) {
					case LITERAL_else:
					{
						AST tmp250_AST_in = (AST)_t;
						match(_t,LITERAL_else);
						_t = _t.getNextSibling();
						block_statement(_t);
						_t = _retTree;
						break;
					}
					case 3:
					{
						break;
					}
					default:
					{
						throw new NoViableAltException(_t);
					}
					}
					}
				}
				else {
					throw new NoViableAltException(_t);
				}
				
				}
				_t = __t203;
				_t = _t.getNextSibling();
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final float  expr(AST _t) throws RecognitionException {
		float binReturn;
		
		AST expr_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		int exprReturn = 0;
		binReturn = 0; 
		
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case ASSIGN:
			case MOD:
			case DEC:
			case MOD_ASSIGN:
			case LTE:
			case PLUS:
			case LOR:
			case PLUS_ASSIGN:
			case EQUAL:
			case NOT_EQUAL:
			case MINUS:
			case LAND:
			case MINUS_ASSIGN:
			case GT:
			case STAR:
			case STAR_ASSIGN:
			case LT:
			case DIV:
			case INC:
			case DIV_ASSIGN:
			case GTE:
			case NCommaExpr:
			case RSHIFT_ASSIGN:
			case LSHIFT_ASSIGN:
			case BAND_ASSIGN:
			case BOR_ASSIGN:
			case BXOR_ASSIGN:
			case BOR:
			case BXOR:
			case BAND:
			case LSHIFT:
			case RSHIFT:
			{
				binReturn=binaryExpr(_t);
				_t = _retTree;
				break;
			}
			case NEmptyExpression:
			{
				emptyExpr(_t);
				_t = _retTree;
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
		return binReturn;
	}
	
	public final void block_statement(AST _t) throws RecognitionException {
		
		AST block_statement_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		AST lc = null;
		AST rc = null;
		
			int tempi;
		
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case SEMI:
			case NStatementExpr:
			case LITERAL_while:
			case LITERAL_do:
			case LITERAL_continue:
			case LITERAL_break:
			case LITERAL_return:
			case LITERAL_if:
			case LITERAL_int:
			case LITERAL_float:
			case LITERAL_readfile:
			case LITERAL_dist:
			case LITERAL_IS:
			case LITERAL_coord:
			case LITERAL_point:
			case LITERAL_line:
			case LITERAL_overlay:
			case LITERAL_persp:
			case LITERAL_struct:
			case LITERAL_place:
			case LITERAL_printk:
			case LITERAL_AsigCity:
			{
				tempi=stmt(_t);
				_t = _retTree;
				break;
			}
			case LCURLY:
			{
				lc = (AST)_t;
				match(_t,LCURLY);
				_t = _t.getNextSibling();
				tabs++;
				{
				int _cnt220=0;
				_loop220:
				do {
					if (_t==null) _t=ASTNULL;
					if (((_tokenSet_0.member(_t.getType())))&&(if_skip_rcurly == 0)) {
						tempi=stmt(_t);
						_t = _retTree;
					}
					else if ((_tokenSet_0.member(_t.getType()))) {
						tempi=stmt(_t);
						_t = _retTree;
					}
					else {
						if ( _cnt220>=1 ) { break _loop220; } else {throw new NoViableAltException(_t);}
					}
					
					_cnt220++;
				} while (true);
				}
				rc = (AST)_t;
				match(_t,RCURLY);
				_t = _t.getNextSibling();
				if_skip_rcurly = 0 ;tabs--;
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void skip_block_statement(AST _t) throws RecognitionException {
		
		AST skip_block_statement_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		AST lc = null;
		AST rc = null;
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case SEMI:
			case NStatementExpr:
			case LITERAL_while:
			case LITERAL_do:
			case LITERAL_continue:
			case LITERAL_break:
			case LITERAL_return:
			case LITERAL_if:
			{
				skip_statement(_t);
				_t = _retTree;
				break;
			}
			case LCURLY:
			{
				lc = (AST)_t;
				match(_t,LCURLY);
				_t = _t.getNextSibling();
				{
				int _cnt217=0;
				_loop217:
				do {
					if (_t==null) _t=ASTNULL;
					if ((_tokenSet_3.member(_t.getType()))) {
						skip_statement(_t);
						_t = _retTree;
					}
					else {
						if ( _cnt217>=1 ) { break _loop217; } else {throw new NoViableAltException(_t);}
					}
					
					_cnt217++;
				} while (true);
				}
				rc = (AST)_t;
				match(_t,RCURLY);
				_t = _t.getNextSibling();
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void skip_statement(AST _t) throws RecognitionException {
		
		AST skip_statement_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		AST s = null;
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case SEMI:
			{
				s = (AST)_t;
				match(_t,SEMI);
				_t = _t.getNextSibling();
				break;
			}
			case NStatementExpr:
			{
				AST __t208 = _t;
				AST tmp251_AST_in = (AST)_t;
				match(_t,NStatementExpr);
				_t = _t.getFirstChild();
				AST tmp252_AST_in = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				_t = __t208;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_while:
			{
				AST __t209 = _t;
				AST tmp253_AST_in = (AST)_t;
				match(_t,LITERAL_while);
				_t = _t.getFirstChild();
				AST tmp254_AST_in = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				skip_block_statement(_t);
				_t = _retTree;
				_t = __t209;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_do:
			{
				AST __t210 = _t;
				AST tmp255_AST_in = (AST)_t;
				match(_t,LITERAL_do);
				_t = _t.getFirstChild();
				skip_block_statement(_t);
				_t = _retTree;
				AST tmp256_AST_in = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				_t = __t210;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_continue:
			{
				AST tmp257_AST_in = (AST)_t;
				match(_t,LITERAL_continue);
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_break:
			{
				AST tmp258_AST_in = (AST)_t;
				match(_t,LITERAL_break);
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_return:
			{
				AST __t211 = _t;
				AST tmp259_AST_in = (AST)_t;
				match(_t,LITERAL_return);
				_t = _t.getFirstChild();
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case ID:
				case COMMENT:
				case StringConstant:
				case WS:
				case DIGITS:
				case INTEGER:
				case ASSIGN:
				case MOD:
				case DEC:
				case MOD_ASSIGN:
				case LTE:
				case PLUS:
				case LOR:
				case PLUS_ASSIGN:
				case EQUAL:
				case NOT_EQUAL:
				case PERIOD:
				case MINUS:
				case LAND:
				case MINUS_ASSIGN:
				case GT:
				case STAR:
				case LNOT:
				case STAR_ASSIGN:
				case LT:
				case DIV:
				case INC:
				case DIV_ASSIGN:
				case GTE:
				case SEMI:
				case LPAREN:
				case RPAREN:
				case LCURLY:
				case RCURLY:
				case LBRACK:
				case RBRACK:
				case COMMA:
				case UNIT:
				case SHAPE:
				case NStatementExpr:
				case NEmptyExpression:
				case NStringSeq:
				case NExpressionGroup:
				case NFunctionCallArgs:
				case NPostfixExpr:
				case NUnaryExpr:
				case NCommaExpr:
				case PROGRAM_AST:
				case LITERAL_while:
				case LITERAL_do:
				case LITERAL_continue:
				case LITERAL_break:
				case LITERAL_return:
				case LITERAL_if:
				case LITERAL_else:
				case LITERAL_int:
				case LITERAL_float:
				case FLOAT:
				case LITERAL_readfile:
				case LITERAL_dist:
				case LITERAL_IS:
				case DIST:
				case LITERAL_dir:
				case LITERAL_N:
				case LITERAL_S:
				case LITERAL_W:
				case LITERAL_E:
				case LITERAL_NE:
				case LITERAL_NW:
				case LITERAL_SE:
				case LITERAL_SW:
				case LITERAL_coord:
				case LITERAL_point:
				case LITERAL_line:
				case LITERAL_overlay:
				case LITERAL_persp:
				case LITERAL_struct:
				case LITERAL_square:
				case LITERAL_rectangle:
				case LITERAL_triangle:
				case LITERAL_octagon:
				case LITERAL_place:
				case LITERAL_printk:
				case LITERAL_AsigCity:
				case QUESTION:
				case COLON:
				case LBRACKET:
				case RBRACKET:
				case CharLiteral:
				case StringLiteral:
				case RSHIFT_ASSIGN:
				case LSHIFT_ASSIGN:
				case BAND_ASSIGN:
				case BOR_ASSIGN:
				case BXOR_ASSIGN:
				case BOR:
				case BXOR:
				case BAND:
				case LSHIFT:
				case RSHIFT:
				{
					AST tmp260_AST_in = (AST)_t;
					if ( _t==null ) throw new MismatchedTokenException();
					_t = _t.getNextSibling();
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				_t = __t211;
				_t = _t.getNextSibling();
				break;
			}
			case LITERAL_if:
			{
				AST __t213 = _t;
				AST tmp261_AST_in = (AST)_t;
				match(_t,LITERAL_if);
				_t = _t.getFirstChild();
				AST tmp262_AST_in = (AST)_t;
				if ( _t==null ) throw new MismatchedTokenException();
				_t = _t.getNextSibling();
				skip_block_statement(_t);
				_t = _retTree;
				{
				if (_t==null) _t=ASTNULL;
				switch ( _t.getType()) {
				case LITERAL_else:
				{
					AST tmp263_AST_in = (AST)_t;
					match(_t,LITERAL_else);
					_t = _t.getNextSibling();
					skip_block_statement(_t);
					_t = _retTree;
					break;
				}
				case 3:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(_t);
				}
				}
				}
				_t = __t213;
				_t = _t.getNextSibling();
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final float  binaryExpr(AST _t) throws RecognitionException {
		float binReturn;
		
		AST binaryExpr_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		AST b = null;
		
			binReturn = 0;
			int entry_index1 = 0;
		
		
		try {      // for error handling
			b = _t==ASTNULL ? null : (AST)_t;
			binaryOperator(_t);
			_t = _retTree;
			
							binReturn = recursive_f(b);				
			
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
		return binReturn;
	}
	
	public final void emptyExpr(AST _t) throws RecognitionException {
		
		AST emptyExpr_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			AST tmp264_AST_in = (AST)_t;
			match(_t,NEmptyExpression);
			_t = _t.getNextSibling();
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	public final void binaryOperator(AST _t) throws RecognitionException {
		
		AST binaryOperator_AST_in = (_t == ASTNULL) ? null : (AST)_t;
		
		try {      // for error handling
			if (_t==null) _t=ASTNULL;
			switch ( _t.getType()) {
			case ASSIGN:
			{
				AST tmp265_AST_in = (AST)_t;
				match(_t,ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case DIV_ASSIGN:
			{
				AST tmp266_AST_in = (AST)_t;
				match(_t,DIV_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case PLUS_ASSIGN:
			{
				AST tmp267_AST_in = (AST)_t;
				match(_t,PLUS_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case MINUS_ASSIGN:
			{
				AST tmp268_AST_in = (AST)_t;
				match(_t,MINUS_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case STAR_ASSIGN:
			{
				AST tmp269_AST_in = (AST)_t;
				match(_t,STAR_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case MOD_ASSIGN:
			{
				AST tmp270_AST_in = (AST)_t;
				match(_t,MOD_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case RSHIFT_ASSIGN:
			{
				AST tmp271_AST_in = (AST)_t;
				match(_t,RSHIFT_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case LSHIFT_ASSIGN:
			{
				AST tmp272_AST_in = (AST)_t;
				match(_t,LSHIFT_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case BAND_ASSIGN:
			{
				AST tmp273_AST_in = (AST)_t;
				match(_t,BAND_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case BOR_ASSIGN:
			{
				AST tmp274_AST_in = (AST)_t;
				match(_t,BOR_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case BXOR_ASSIGN:
			{
				AST tmp275_AST_in = (AST)_t;
				match(_t,BXOR_ASSIGN);
				_t = _t.getNextSibling();
				break;
			}
			case LOR:
			{
				AST tmp276_AST_in = (AST)_t;
				match(_t,LOR);
				_t = _t.getNextSibling();
				break;
			}
			case LAND:
			{
				AST tmp277_AST_in = (AST)_t;
				match(_t,LAND);
				_t = _t.getNextSibling();
				break;
			}
			case BOR:
			{
				AST tmp278_AST_in = (AST)_t;
				match(_t,BOR);
				_t = _t.getNextSibling();
				break;
			}
			case BXOR:
			{
				AST tmp279_AST_in = (AST)_t;
				match(_t,BXOR);
				_t = _t.getNextSibling();
				break;
			}
			case BAND:
			{
				AST tmp280_AST_in = (AST)_t;
				match(_t,BAND);
				_t = _t.getNextSibling();
				break;
			}
			case EQUAL:
			{
				AST tmp281_AST_in = (AST)_t;
				match(_t,EQUAL);
				_t = _t.getNextSibling();
				break;
			}
			case NOT_EQUAL:
			{
				AST tmp282_AST_in = (AST)_t;
				match(_t,NOT_EQUAL);
				_t = _t.getNextSibling();
				break;
			}
			case LT:
			{
				AST tmp283_AST_in = (AST)_t;
				match(_t,LT);
				_t = _t.getNextSibling();
				break;
			}
			case LTE:
			{
				AST tmp284_AST_in = (AST)_t;
				match(_t,LTE);
				_t = _t.getNextSibling();
				break;
			}
			case GT:
			{
				AST tmp285_AST_in = (AST)_t;
				match(_t,GT);
				_t = _t.getNextSibling();
				break;
			}
			case GTE:
			{
				AST tmp286_AST_in = (AST)_t;
				match(_t,GTE);
				_t = _t.getNextSibling();
				break;
			}
			case LSHIFT:
			{
				AST tmp287_AST_in = (AST)_t;
				match(_t,LSHIFT);
				_t = _t.getNextSibling();
				break;
			}
			case RSHIFT:
			{
				AST tmp288_AST_in = (AST)_t;
				match(_t,RSHIFT);
				_t = _t.getNextSibling();
				break;
			}
			case PLUS:
			{
				AST tmp289_AST_in = (AST)_t;
				match(_t,PLUS);
				_t = _t.getNextSibling();
				break;
			}
			case MINUS:
			{
				AST tmp290_AST_in = (AST)_t;
				match(_t,MINUS);
				_t = _t.getNextSibling();
				break;
			}
			case STAR:
			{
				AST tmp291_AST_in = (AST)_t;
				match(_t,STAR);
				_t = _t.getNextSibling();
				break;
			}
			case DIV:
			{
				AST tmp292_AST_in = (AST)_t;
				match(_t,DIV);
				_t = _t.getNextSibling();
				break;
			}
			case MOD:
			{
				AST tmp293_AST_in = (AST)_t;
				match(_t,MOD);
				_t = _t.getNextSibling();
				break;
			}
			case NCommaExpr:
			{
				AST tmp294_AST_in = (AST)_t;
				match(_t,NCommaExpr);
				_t = _t.getNextSibling();
				break;
			}
			case INC:
			{
				AST tmp295_AST_in = (AST)_t;
				match(_t,INC);
				_t = _t.getNextSibling();
				break;
			}
			case DEC:
			{
				AST tmp296_AST_in = (AST)_t;
				match(_t,DEC);
				_t = _t.getNextSibling();
				break;
			}
			default:
			{
				throw new NoViableAltException(_t);
			}
			}
		}
		catch (RecognitionException ex) {
			reportError(ex);
			if (_t!=null) {_t = _t.getNextSibling();}
		}
		_retTree = _t;
	}
	
	
	public static final String[] _tokenNames = {
		"<0>",
		"EOF",
		"<2>",
		"NULL_TREE_LOOKAHEAD",
		"ID",
		"COMMENT",
		"StringConstant",
		"WS",
		"DIGITS",
		"INTEGER",
		"ASSIGN",
		"MOD",
		"DEC",
		"MOD_ASSIGN",
		"LTE",
		"PLUS",
		"LOR",
		"PLUS_ASSIGN",
		"EQUAL",
		"NOT_EQUAL",
		"PERIOD",
		"MINUS",
		"LAND",
		"MINUS_ASSIGN",
		"GT",
		"STAR",
		"LNOT",
		"STAR_ASSIGN",
		"LT",
		"DIV",
		"INC",
		"DIV_ASSIGN",
		"GTE",
		"SEMI",
		"LPAREN",
		"RPAREN",
		"LCURLY",
		"RCURLY",
		"LBRACK",
		"RBRACK",
		"COMMA",
		"UNIT",
		"SHAPE",
		"NStatementExpr",
		"NEmptyExpression",
		"NStringSeq",
		"NExpressionGroup",
		"NFunctionCallArgs",
		"NPostfixExpr",
		"NUnaryExpr",
		"NCommaExpr",
		"PROGRAM_AST",
		"\"while\"",
		"\"do\"",
		"\"continue\"",
		"\"break\"",
		"\"return\"",
		"\"if\"",
		"\"else\"",
		"\"int\"",
		"\"float\"",
		"FLOAT",
		"\"readfile\"",
		"\"dist\"",
		"\"IS\"",
		"DIST",
		"\"dir\"",
		"\"N\"",
		"\"S\"",
		"\"W\"",
		"\"E\"",
		"\"NE\"",
		"\"NW\"",
		"\"SE\"",
		"\"SW\"",
		"\"coord\"",
		"\"point\"",
		"\"line\"",
		"\"overlay\"",
		"\"persp\"",
		"\"struct\"",
		"\"square\"",
		"\"rectangle\"",
		"\"triangle\"",
		"\"octagon\"",
		"\"place\"",
		"\"printk\"",
		"\"AsigCity\"",
		"QUESTION",
		"COLON",
		"LBRACKET",
		"RBRACKET",
		"CharLiteral",
		"StringLiteral",
		"RSHIFT_ASSIGN",
		"LSHIFT_ASSIGN",
		"BAND_ASSIGN",
		"BOR_ASSIGN",
		"BXOR_ASSIGN",
		"BOR",
		"BXOR",
		"BAND",
		"LSHIFT",
		"RSHIFT"
	};
	
	private static final long[] mk_tokenSet_0() {
		long[] data = { -2598568180309819392L, 14809089L, 0L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
	private static final long[] mk_tokenSet_1() {
		long[] data = { -2598568111590342656L, 14809089L, 0L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
	private static final long[] mk_tokenSet_2() {
		long[] data = { 283735649926774784L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
	private static final long[] mk_tokenSet_3() {
		long[] data = { 283735581207298048L, 0L};
		return data;
	}
	public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
	}
	
