public SymbolTable Analyze(Ast ast) { var symbols = new SymbolTable(); ast.Accept(new ModAnalyzer(log, symbols)); // TODO(kai): Check that variABLES ACTUALLY EXIST return symbols; }
public void Visit(Ast node) { node.children.ForEach(child => { WriteTabs(); child.Accept(this); WriteLine(); }); }
public LLVMModuleRef Compile(string name, Ast ast, SymbolTable symbols) { var context = ContextCreate(); var module = ModuleCreateWithNameInContext(name, context); var builder = CreateBuilderInContext(context); var compiler = new ModCompiler(log, new SymbolTableWalker(symbols), context, module, builder); ast.Accept(compiler); return module; }
public void Check(Ast ast, SymbolTable symbols) { var resolver = new TyResolver(log); resolver.Resolve(ast, symbols); if (log.HasErrors) return; var checker = new TyChecker(log, new SymbolTableWalker(symbols)); ast.Accept(checker); }
public void Resolve(Ast ast, SymbolTable symbols) { walker = new SymbolTableWalker(symbols); do { walker.Reset(); hasResolved = true; ast.Accept(this); } while (!hasResolved); }
public Ast Parse(DetailLogger log, TokenList tokens, string fileName) { var state = new ParserState(log, tokens, fileName); var ast = new Ast(); // TODO(kai): actually run a parser loop. while (true) { //Console.WriteLine("Attempting to parse"); var node = state.ParseTopLevel(); if (node == null) break; ast.children.Add(node); } return ast; }
public void Visit(Ast node) => node.children.ForEach(child => child.Accept(this));