public CodeGenerator(TextWriter sink, Program program, GlobalSymbolTable symbols, DiagnosticsReport diagnostics, NativeDB nativeDB) { Sink = sink; Program = program; Symbols = symbols; Diagnostics = diagnostics; NativeDB = nativeDB; Strings = new(); stmtEmitter = new(this); valueEmitter = new(this); addressEmitter = new(this); optimizer = new(); funcInstructions = new(); }
public bool Generate() { if (Diagnostics.HasErrors) { return(false); } Allocator.Allocate(Program, Diagnostics); if (Diagnostics.HasErrors) { return(false); } Strings = StringsTableBuilder.Build(Program); EmitDirectives(); EmitGlobalsSegment(); EmitStaticsSegment(); EmitStringsSegment(); EmitIncludeSegment(); EmitCodeSegment(); return(true); }