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 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;
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public void Resolve(Ast ast, SymbolTable symbols)
 {
     walker = new SymbolTableWalker(symbols);
     
     do
     {
         walker.Reset();
         hasResolved = true;
         ast.Accept(this);
     }
     while (!hasResolved);
 }
Beispiel #5
0
 public ModAnalyzer(DetailLogger log, SymbolTable symbols)
 {
     this.log = log;
     this.symbols = symbols;
 }
 public SymbolTableWalker(SymbolTable symbols)
 {
     this.symbols = symbols;
     Reset();
 }