Exemplo n.º 1
0
        protected override void ToCompare(TokenType type, ExpressionNode left, ExpressionNode right, IDictionary <IdentifierNode, uint> anaxDictionary)
        {
            string op;

            switch (type)
            {
            case TokenType.XTLO:
                op = "xtlo";
                break;

            case TokenType.XYLO:
                op = "xylo";
                break;

            case TokenType.CLO:
                op = "clo";
                break;

            case TokenType.NIV:
                op = "niv";
                break;

            case TokenType.LLO:
                op = "llo";
                break;

            case TokenType.XOLO:
                op = "xolo";
                break;

            case TokenType.XTLONYS:
                op = "xtlonys";
                break;

            case TokenType.XYLONYS:
                op = "xylonys";
                break;

            case TokenType.LLONYS:
                op = "llonys";
                break;

            case TokenType.XOLONYS:
                op = "xolonys";
                break;

            default:
                throw new ArgumentException($"Invalid compare type: {type}");
            }

            OutputExpression(left, "f0", anaxDictionary);
            if (right is IdentifierNode || right is ConstantNode)
            {
                OutputValue(right, "f1", anaxDictionary);
                this.writer.WriteLine("nta 4 f5 krz 0 f5@ ; allocate temporary at compare");
            }
            else
            {
                this.writer.WriteLine("nta 4 f5 krz f0 f5@ ; allocate temporary at compare");
                OutputExpression(right, "f0", anaxDictionary);
                this.writer.WriteLine("inj f5@ f0 f1 krz 0 f5@");
            }
            this.writer.WriteLine("fi f0 f1 {0} malkrz 1 f5@ ; f0 {0} f1", op);
            this.writer.WriteLine("krz f5@ f0 ata 4 f5");
        }
Exemplo n.º 2
0
 protected override void ToNac(ExpressionNode value, IDictionary <IdentifierNode, uint> anaxDictionary)
 {
     OutputExpression(value, "f0", anaxDictionary);
     this.writer.WriteLine("dal 0 f0 ; nac f0");
 }