static void Run(string source) { var stmts = new List <Stmt>(); try { var scanner = new Scanner(source); var tokens = scanner.ScanTokens(); var parser = new Parser(tokens); stmts = parser.Parse(); var resolve = new ResolutionVisitor(Interpreter); resolve.Resolve(stmts); } catch (LoxStaticErrorException loxStaticError) { StaticError(loxStaticError.Token.Line, loxStaticError.Message); return; } if (hadStaticError) { return; } Interpreter.Interpret(stmts); }
/// <summary> /// Set up this scopes lexically-declared fields /// </summary> public override void DeclareScope(ResolutionVisitor resolutionVisitor) { // only bind lexical declarations DefineLexicalDeclarations(resolutionVisitor); }