public CompilerResult Compile(ElaProgram prog, CompilerOptions options, ExportVars builtins, CodeFrame frame, Scope globalScope) { Options = options; var helper = new Builder(frame, this, builtins, globalScope); try { helper.CompileUnit(prog); } catch (TerminationException) { //Nothing should be done here. This was thrown to stop compilation. } #if !DEBUG catch (Exception ex) { if (ex is ElaCompilerException) { throw; } throw new ElaCompilerException(Strings.GetMessage("Ice", ex.Message), ex); } #endif frame.Symbols = frame.Symbols == null ? helper.Symbols : helper.Symbols != null?frame.Symbols.Merge(helper.Symbols) : frame.Symbols; frame.GlobalScope = globalScope; return(new CompilerResult(frame, helper.Success, helper.Errors.ToArray())); }
public CompilerResult Compile(ElaProgram prog, CompilerOptions options, ExportVars builtins, CodeFrame frame, Scope globalScope) { Options = options; var helper = new Builder(frame, this, builtins, globalScope); try { helper.CompileUnit(prog); } catch (TerminationException) { //Nothing should be done here. This was thrown to stop compilation. } #if !DEBUG catch (Exception ex) { if (ex is ElaCompilerException) throw; throw new ElaCompilerException(Strings.GetMessage("Ice", ex.Message), ex); } #endif frame.Symbols = frame.Symbols == null ? helper.Symbols : helper.Symbols != null ? frame.Symbols.Merge(helper.Symbols) : frame.Symbols; frame.GlobalScope = globalScope; return new CompilerResult(frame, helper.Success, helper.Errors.ToArray()); }
private ExportVars exports; //Exports for current module //globalScope is not empty (e.g. new Scope()) only if we are resuming in interactive mode internal Builder(CodeFrame frame, ElaCompiler comp, ExportVars exportVars, Scope globalScope) { this.frame = frame; this.options = comp.Options; this.exports = exportVars; this.comp = comp; this.cw = new CodeWriter(frame.Ops, frame.OpData); this.globalScope = globalScope; CurrentScope = globalScope; debug = options.GenerateDebugInfo; opt = options.Optimize; stringLookup = new Dictionary <String, Int32>(); cleans.Push(true); ResumeIndexer(); Success = true; }
private Dictionary<String, Int32> stringLookup; //String table #endregion Fields #region Constructors //globalScope is not empty (e.g. new Scope()) only if we are resuming in interactive mode internal Builder(CodeFrame frame, ElaCompiler comp, ExportVars exportVars, Scope globalScope) { this.frame = frame; this.options = comp.Options; this.exports = exportVars; this.comp = comp; this.cw = new CodeWriter(frame.Ops, frame.OpData); this.globalScope = globalScope; CurrentScope = globalScope; debug = options.GenerateDebugInfo; opt = options.Optimize; stringLookup = new Dictionary<String,Int32>(); cleans.Push(true); ResumeIndexer(); Success = true; }
public CompilerResult Compile(ElaProgram prog, CompilerOptions options, ExportVars builtins) { var frame = new CodeFrame(); return(Compile(prog, options, builtins, frame, new Scope(false, null))); }
public CompilerResult Compile(ElaProgram prog, CompilerOptions options, ExportVars builtins) { var frame = new CodeFrame(); return Compile(prog, options, builtins, frame, new Scope(false, null)); }