Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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 + " ;", "", "");
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
 public override void CompileFunction(Assembly assembly, Scope topscope)
 {
     //if (references == 0) return;
     foreach (var line in code)
     {
         assembly.Barrier();
         assembly.Add(line, "", "");
     }
 }
Esempio n. 5
0
 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);
 }