Exemplo n.º 1
0
        // public string Name;
        // public Expression Expression;
        // public Expression Recipient;
        // public Type Type;

        public override void Compile(GeneratorState state, Trac42Program program)
        {
            program.Emit(new Instruction(Instruction.OPCODE.DECL, 1));
            state.Bind(Name);
            Expression.Compile(state, program);

            switch (Type)
            {
            case Type.BoolType:
                program.Emit(new Instruction(Instruction.OPCODE.ASSBOOL));
                break;

            case Type.NumType:
                program.Emit(new Instruction(Instruction.OPCODE.ASSINT));
                break;
            }

            Recipient.Compile(state, program);
            state.Unbind(Name);
            program.Emit(new Instruction(Instruction.OPCODE.POP, 1));
        }