예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public Exp Expr()
        {
            TOKEN l_token;
            Exp   RetValue = Term();

            while (Current_Token == TOKEN.TOK_PLUS || Current_Token == TOKEN.TOK_SUB)
            {
                l_token       = Current_Token;
                Current_Token = GetToken();
                Exp e1 = Expr();
                RetValue = new BinaryExp(RetValue, e1,
                                         l_token == TOKEN.TOK_PLUS ? OPERATOR.PLUS : OPERATOR.MINUS);
            }

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

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


                Exp e1 = Term();
                RetValue = new BinaryExp(RetValue, e1,
                                         l_token == TOKEN.TOK_MUL ? OPERATOR.MUL : OPERATOR.DIV);
            }

            return(RetValue);
        }