public void Transpile() { Grammar rubyGrammar = new RubyGrammar(); LanguageCompiler rubyCompiler; SyntaxErrors = new SyntaxErrorList(); Generator generator = new Generator(); try { rubyCompiler = new LanguageCompiler(rubyGrammar); } catch (Exception ex) { throw new ArgumentException("Ruby Grammar: " + ex.Message); } try { AstRootNode = rubyCompiler.Parse(RubyScript); SyntaxErrors = rubyCompiler.Context.Errors; } catch (Exception ex) { throw new ArgumentException("Parser error: " + rubyCompiler.Parser.CurrentState + " " + ex.Message); } if (SyntaxErrors.Count > 0) { foreach (SyntaxError err in SyntaxErrors) { Logger.log("error", err + " >> " + RubyScript.Insert(err.Location.Position, "§")); } } try { GeneratedDictionary = generator.Generate(AstRootNode).Dictionary; } catch (Exception ex) { Logger.log("error", "Compile error: " + ex.Message); } try { TranspiledPowerShell = ToPowerShell(); } catch (Exception ex) { Logger.log("error", "Error transpiling to PowerShell: " + ex.Message); } try { CompiledJson = JsonHelper.Serialize(GeneratedDictionary); } catch (Exception ex) { Logger.log("error", "Error generating json result: " + ex.Message); } }