예제 #1
0
파일: Parser.cs 프로젝트: Tori-nkt/Laba_5
        private Expression GrabTerm()
        {
            Expression left = this.GrabFactor();

            while (this.curToken.Type == TokenType.Multiply ||
                   this.curToken.Type == TokenType.Divide)
            {
                Token op = this.curToken;
                this.NextToken();
                Expression right = this.GrabFactor();
                left = new BinOp(op, left, right);
            }

            return(left);
        }
예제 #2
0
파일: Parser.cs 프로젝트: Tori-nkt/Laba_5
        private Expression GrabExpr()
        {
            Expression left = this.GrabTerm();

            while (this.curToken.Type == TokenType.Plus ||
                   this.curToken.Type == TokenType.Minus)
            {
                Token op = this.curToken;
                this.NextToken();
                Expression right = this.GrabTerm();
                left = new BinOp(op, left, right);
            }

            return(left);
        }