private bool BuildSource() { bool result = false; Log("_______________________________________________________________"); Log(""); var outStream = new FileStream(outputFileName, FileMode.Create); Log("Starting build..."); var compiler = new Compiler(); var text = (string)this.Invoke(new Func<string>(() => SourceBox.Text)); result = compiler.Compile(text, outStream); var errorsContainer = compiler.GetErrorsContainer(); foreach (var ev in errorsContainer) { text = (string)this.Invoke(new Func<string>(() => SourceBox.Text)); int id = Log(TextUtils.WriteCompilerError(text, ev)); m_errorPositions.Add(id, ev.Position); } if (result) { Log("Compiled successfully!"); Log(""); } outStream.Close(); return result; }
static void Main(string[] args) { string[] lines = File.ReadAllLines(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "//snippets//example.txt"); Tokenizer tokenizer = new Tokenizer(lines); Compiler compiler = new Compiler(); compiler.compile(tokenizer.getTokens()); VirtualMachine vm = new VirtualMachine(); vm.Run(compiler.Nodes); Console.ReadLine(); }
public CompileIf(Compiler compiler) { this.compiler = compiler; }
public CompileWhile(Compiler compiler) { this.compiler = compiler; }