public void EmitIR(CILEmitter Emitter) { CILEmitter proc = Emitter.StartProcedure(identifier, Parameters, ReturnType); block.EmitIR(proc); proc.Return(); }
public void EmitIR(CILEmitter Emitter) { if (variable.IsReference) { if (reference.ArrayIndex == null) { Emitter.LoadVariable(reference.Name); assigment.EmitIR(Emitter, false); Emitter.SaveReferenceVariable(variable); } else { Emitter.LoadReferenceVariable(variable); reference.ArrayIndex.EmitIR(Emitter, false); assigment.EmitIR(Emitter, false); Emitter.SaveArray(variable); } } else { if (reference.ArrayIndex == null) { assigment.EmitIR(Emitter, false); Emitter.SaveVariable(reference.Name); } else { Emitter.LoadVariable(variable.Identifier); reference.ArrayIndex.EmitIR(Emitter, false); assigment.EmitIR(Emitter, false); Emitter.SaveArray(variable); } } }
public void EmitIR(CILEmitter Emitter, bool Reference) { if (Reference) { if (Type.IsArray && reference.ArrayIndex != null) { Emitter.LoadVariable(reference.Name); reference.ArrayIndex.EmitIR(Emitter, false); Emitter.LoadArrayIndexAddress(Type); } else { Emitter.LoadVariableAddress(reference.Name); } } else if (variable.IsReference) { Emitter.LoadReferenceVariable(variable); } else { Emitter.LoadVariable(reference.Name); if (reference.ArrayIndex != null) { reference.ArrayIndex.EmitIR(Emitter, false); Emitter.LoadArrayVariable(variable); } } }
public void EmitIR(CILEmitter Emitter, bool Reference) { if (Reference) { throw new InvalidByReferenceException(); } for (int i = 0; i < arguments.Count; i++) { IExpression expr = arguments.Expression(i); bool loadReference = ToCall.Parameters.At(i).IsReference; expr.EmitIR(Emitter, loadReference); } foreach (Variable prevVar in ToCall.Parameters.PreviousVariables) { if (current.Variable(prevVar.Identifier).IsReference) { Emitter.LoadVariable(prevVar.Identifier); } else { Emitter.LoadVariableAddress(prevVar.Identifier); } } Emitter.Call(toBeCalled); }
public void EmitIR(CILEmitter Emitter) { call.EmitIR(Emitter, false); if (call.ToCall.ReturnType != null) { Emitter.Pop(); } }
public void EmitIR(CILEmitter Emitter, bool Reference) { if (Reference) { throw new InvalidByReferenceException(); } Emitter.CallRead(Type); }
public void EmitIR(CILEmitter Emitter, bool Reference) { if (Reference) { throw new InvalidByReferenceException(); } Emitter.PushInt32(literal); }
public void EmitIR(CILEmitter Emitter, bool Reference) { if (Reference) { throw new InvalidByReferenceException(); } expression.EmitIR(Emitter, Reference); }
public void EmitIR(CILEmitter Emitter, bool Reference) { if (Reference) { throw new InvalidByReferenceException(); } factor.EmitIR(Emitter, false); Type.UnaryOperation(oper).EmitIR(Emitter); }
public void EmitIR(CILEmitter Emitter, bool Reference) { if (Reference) { throw new InvalidByReferenceException(); } int booleanValue = literal ? 1 : 0; Emitter.PushInt32(booleanValue); }
public void EmitIR(CILEmitter Emitter, bool Reference) { if (Reference) { throw new InvalidByReferenceException(); } factor.EmitIR(Emitter, false); Emitter.ArraySize(); Emitter.ToInt32(); }
public void EmitIR(CILEmitter Emitter) { for (int i = 0; i < toPrint.Count; i++) { IExpression expr = toPrint.Expression(i); MiniPascalType exprType = toPrint.Type(i); expr.EmitIR(Emitter, false); Emitter.CallPrint(exprType); } }
public void EmitIR(CILEmitter Emitter) { condition.EmitIR(Emitter, false); if (elseStatement == null) { Emitter.If(() => thenStatement.EmitIR(Emitter)); } else { Emitter.IfElse(() => thenStatement.EmitIR(Emitter), () => elseStatement.EmitIR(Emitter)); } }
protected override void LoadFirst(CILEmitter Emitter, bool Reference) { base.LoadFirst(Emitter, Reference); if (sign == OperatorType.Substraction) { if (Type.Equals(MiniPascalType.Integer)) { Emitter.PushInt32(-1); } else if (Type.Equals(MiniPascalType.Real)) { Emitter.PushSingle(-1f); } Emitter.Multiply(); return; } }
public void EmitIR(CILEmitter Emitter) { Emitter.CallStringLessThan(); }
public void EmitIR(CILEmitter Emitter) { Emitter.LessThan(); }
public void EmitIR(CILEmitter Emitter) { Emitter.CallStringEquals(); Emitter.PushInt32(0); Emitter.Equals(); }
public void EmitIR(CILEmitter Emitter) { Emitter.Divide(); }
public void EmitIR(CILEmitter Emitter) { Emitter.Equals(); }
public void EmitIR(CILEmitter Emitter) { Emitter.GreaterThan(); Emitter.PushInt32(0); Emitter.Equals(); }
public void EmitIR(CILEmitter Emitter) { Emitter.CallStringEquals(); }
public void EmitIR(CILEmitter Emitter) { toAssert.EmitIR(Emitter, false); Emitter.Assert(); }
public void EmitIR(CILEmitter Emitter) { Emitter.Modulo(); }
public void EmitIR(CILEmitter Emitter) { Emitter.While(() => condition.EmitIR(Emitter, false), () => doStatement.EmitIR(Emitter)); }
public void EmitIR(CILEmitter Emitter) { Emitter.GreaterThan(); }
public void EmitIR(CILEmitter Emitter) { Emitter.Multiply(); }
public void EmitIR(CILEmitter Emitter) { Emitter.Substract(); }
public void EmitIR(CILEmitter Emitter) { Emitter.Add(); }
public void EmitIR(CILEmitter Emitter) { Emitter.CallStringConcat(); }
public void EmitIR(CILEmitter Emitter) { Emitter.Or(); }