Пример #1
0
        private IAstNode Shift(IAstNode left, int level)
        {
            AstLeaf  op    = new AstLeaf(_lexer.Read());
            IAstNode right = Factor();

            Precedence next;

            while ((next = NextOperator()) != null && RightFirst(level, next))
            {
                right = Shift(right, next.Level);
            }

            return(new ExpressionNode(new Collection <IAstNode>()
            {
                left, op, right
            }));
        }
Пример #2
0
        private IAstNode Shift(IAstNode left, int level)
        {
            AstLeaf op = new AstLeaf(_lexer.Read());
            IAstNode right = Factor();

            Precedence next;
            while ((next = NextOperator()) != null && RightFirst(level, next)) right = Shift(right, next.Level);

            return new ExpressionNode(new Collection<IAstNode>() { left, op, right });
        }