예제 #1
0
        public termAST parseTerm()
        {
            listMulopFactorAST temp   = null;
            listMulopFactorAST result = null;
            factorAST          fact   = null;
            mulopAST           mul    = null;
            factorAST          fact2  = null;

            fact = parseFactor();
            Boolean ind = false;

            while (currentToken.sym == sym.POR | currentToken.sym == sym.DIV | currentToken.sym == sym.PORC)
            {
                if (ind == false)
                {
                    mul    = parseMulop();
                    fact2  = parseFactor();
                    result = new unMulopTermAST(mul, fact2);
                    ind    = true;
                }
                else
                {
                    mul    = parseMulop();
                    fact2  = parseFactor();
                    temp   = new unMulopTermAST(mul, fact2);
                    result = new varMulopTermAST(result, temp);
                }
            }
            if (ind == false)
            {
                return(new termSinMulopFactorAST(fact));
            }

            else
            {
                return(new termConMulopFactorAST(fact, result));
            }
        }
예제 #2
0
 Object VisitMulopAST(mulopAST var, object arg)
 {
     int numaux = ((Integer)arg).intValue(); printtab(numaux); System.out.println(c.getClass().getName());  if(c.- !=null)  c.-.visit(this,new Integer(numaux+1)); else{printtab(numaux+1);  Console.WriteLine(“NULL”);} return null;
 }
예제 #3
0
 public unMulopTermAST(mulopAST m, factorAST f)
 {
     mulop = m;
     factor = f;
 }