Ejemplo n.º 1
0
        private string IdentificatorOrValuePrint(string levelTabulatiion, ASTNode node)
        {
            string register = "";

            if (node is IdentificatorAST sideNodeIdentificatorAST)
            {
                register = IdentificatorPrint(levelTabulatiion, sideNodeIdentificatorAST);
            }
            else
            {
                register = ASMregisters.GetFreeRegister(ASMregisters.Register.DATA);
                IEject value = (node as IEject);
                ASM.WriteASMCode(levelTabulatiion + "mov\t" + register + ", " + value.GetValue());
            }
            return(register);
        }
Ejemplo n.º 2
0
        private void ValuePrint(string levelTabulatiion, ASTNode leftNode, ASTNode rightNode, ref string registerLeft, ref string registerRight)
        {
            registerLeft = ASMregisters.GetFreeRegister(ASMregisters.Register.DATA);
            IEject valueLeft = (leftNode as IEject);

            ASM.WriteASMCode(levelTabulatiion + "mov\t" + registerLeft + ", " + valueLeft.GetValue());
            if (rightNode is BinaryExprAST || rightNode is ParenthesisExprAST || rightNode is BoolAST)
            {
                PrintExprAST(rightNode, levelTabulatiion);
                PrintPop(levelTabulatiion, ref registerLeft);
                PrintPop(levelTabulatiion, ref registerRight);
            }
            else
            {
                registerRight = IdentificatorOrValuePrint(levelTabulatiion, rightNode);
            }
        }