Ejemplo n.º 1
0
 public void Assemble(IList <object> instructions)
 {
     foreach (object o in instructions)
     {
         if (o is Instruction)
         {
             Instruction ins = o as Instruction;
             if (!assemblers.Any(a => a.Mnemonics.Contains <string>(ins.Name)))
             {
                 CreateError("Unknown instruction {0}", ins.Name);
             }
             else
             {
                 AbstractAssembler asm = assemblers.First(a => a.Mnemonics.Contains <string>(ins.Name));
                 if (asm != null)
                 {
                     asm.Assemble(this, ins, this.output);
                 }
             }
         }
         else if (o is Label)
         {
             Label lbl = o as Label;
             output.Emit(new QuasarSymbol(lbl.Name));
         }
     }
 }
Ejemplo n.º 2
0
 public static void RegisterAssembler(AbstractAssembler asm)
 {
     assemblers.Add(asm);
 }