예제 #1
0
        private string SimpleExpression(SimpleExpressionNode node)
        {
            string output = "";

            output += Term(node.term);
            if (node.sign == "-")
            {
                output += "lcd.i4.m1\n";
                output += "mul\n";
            }
            if (node.part != null)
            {
                output += SimpleExpressionPart(node.part);
            }
            return(output);
        }
예제 #2
0
        public SimpleExpressionNode SimpleExpression()
        {
            var simpleExpression = new SimpleExpressionNode();

            if (token.type == TokenTypes.ADDOP && token.value != "or")
            {
                simpleExpression.sign = token.value;
                Match(TokenTypes.ADDOP);
            }
            simpleExpression.term = Term();
            if (token.type == TokenTypes.ADDOP)
            {
                simpleExpression.part = SimpleExpressionPart();
            }

            return(simpleExpression);
        }