예제 #1
0
        /// <summary>
        /// <Term> ::=  <Factor> | <Factor>  {*|/} <Term>
        /// </summary>
        public Exp Term(ProcedureBuilder ctx)
        {
            TOKEN l_token;
            Exp   RetValue = Factor(ctx);

            while (Current_Token == TOKEN.TOK_MUL || Current_Token == TOKEN.TOK_DIV)
            {
                l_token       = Current_Token;
                Current_Token = GetToken();


                Exp e1 = Term(ctx);
                if (l_token == TOKEN.TOK_MUL)
                {
                    RetValue = new Mul(RetValue, e1);
                }
                else
                {
                    RetValue = new Div(RetValue, e1);
                }
            }

            return(RetValue);
        }
예제 #2
0
        /// <summary>
        /// <Term> ::=  <Factor> | <Factor>  {*|/} <Term>
        /// </summary>
        public Exp Term(COMPILATION_CONTEXT ctx)
        {
            TOKEN l_token;
            Exp   RetValue = Factor(ctx);

            while (Current_Token == TOKEN.TOK_MUL || Current_Token == TOKEN.TOK_DIV)
            {
                l_token       = Current_Token;
                Current_Token = GetToken();


                Exp e1 = Term(ctx);
                if (l_token == TOKEN.TOK_MUL)
                {
                    RetValue = new Mul(RetValue, e1);
                }
                else
                {
                    RetValue = new Div(RetValue, e1);
                }
            }

            return(RetValue);
        }