public static void CompileBlock(Assembly assembly, Scope scope, CompilableNode block) { var blockScope = BeginBlock(scope); assembly.Barrier(); block.Compile(assembly, blockScope, Register.DISCARD); assembly.Barrier(); EndBlock(assembly, blockScope); }
public override void Compile(Assembly assembly, Scope scope, Register target) { var lines = AsString.Split(new String[2]{"\n", "\r"}, StringSplitOptions.RemoveEmptyEntries); assembly.Barrier(); foreach (var str in lines) assembly.Add(str + " ;", "", ""); }
public override void Compile(Assembly assembly, Scope scope, Register target) { foreach (var child in ChildNodes) { assembly.Barrier(); (child as CompilableNode).Compile(assembly, scope, Register.DISCARD); } }
public override void CompileFunction(Assembly assembly, Scope topscope) { //if (references == 0) return; foreach (var line in code) { assembly.Barrier(); assembly.Add(line, "", ""); } }
public virtual void CompileFunction(Assembly assembly, Scope topscope) { Scope lScope; if (localScope != null) { foreach (var variable in topscope.variables) if (variable.location == Register.STATIC) localScope.variables.Add(variable); lScope = localScope.Push(new Scope()); assembly.Add(":" + label, "", ""); } else lScope = topscope; assembly.Barrier(); if (localScope != null) lScope.stackDepth += 1; //account for return address (ChildNodes[0] as CompilableNode).Compile(assembly, lScope, Register.DISCARD); if (localScope != null) CompileReturn(assembly, lScope); else assembly.Add("BRK", "", ""); assembly.Barrier(); //Should leave the return value, if any, in A. foreach (var function in lScope.pendingFunctions) function.CompileFunction(assembly, topscope); }