public void Assemble(string program, BinaryWriter output) { myLabelLookup = new Hashtable(); myExecutionAddress = 0; isEnd = false; mySourceCrawler = new SourceCrawler(program, 0); mySourceCrawler.SetLookupTable(myLabelLookup); // Write the majic number output.Write(CompilerSettings.MagicCharacters); output.Write(mySourceCrawler.AssemblyLength); output.Write((uint)0); // Leave space for execution address long start = output.BaseStream.Position; Parse(output); // Actually generate bytecode long end = output.BaseStream.Position; uint progLength = (uint)(end - start); output.Seek(3, SeekOrigin.Begin); // Seek to execution address output.Write(progLength); // write execution address output.Seek(3 + 2, SeekOrigin.Begin); // Seek to execution address output.Write(myExecutionAddress); // write execution address }
public abstract void Interpret(SourceCrawler sourceCrawler, BinaryWriter output, bool isLabelScan);