Пример #1
0
        //if statment
        public CStatment(CExpression cExpression, CStatment cStatment)
        {
            string ifBody = CIdentifier.AutoGenerateLabel("ifBody");
            string EndIf  = CIdentifier.AutoGenerateLabel("endIf");

            Add(cExpression);
            Add(new OpCodeEmitter(OpCode.PUSHW, ifBody));
            Add(new OpCodeEmitter(OpCode.JIF));
            Add(new OpCodeEmitter(OpCode.PUSHW, EndIf));
            Add(new OpCodeEmitter(OpCode.JMP));
            Add(new LabelEmitter(ifBody));
            Add(cStatment);
            Add(new LabelEmitter(EndIf));
        }
Пример #2
0
 private static void EnterLoop()
 {
     loopChechLabels.Push(CIdentifier.CreatLabel(CIdentifier.AutoGenerateLabel("LoopCheck")));
     loopBodyLabels.Push(CIdentifier.CreatLabel(CIdentifier.AutoGenerateLabel("LoopBody")));
     endLoopLabels.Push(CIdentifier.CreatLabel(CIdentifier.AutoGenerateLabel("EndLoop")));
 }