public SymbolTable Build(AstProgram node)
        {
            table = new SymbolTable();

            AddBuiltInSymbols();
            node.Accept(this);

            return table;
        }
        public bool Evaluate(AstProgram node)
        {
            var tableBuilder = new SymbolTableBuilder();

            result = true;
            isClassFieldDef = false;
            try
            {
                table = tableBuilder.Build(node);
            }
            catch (CallableSymbolAlreadyDefinedException e)
            {
                DispatchError(new SourcePosition(), "Function already defined: " + e.Message);
                return false;
            }
            catch (SymbolAlreadyDefinedException e)
            {
                DispatchError(new SourcePosition(), "Variable already defined: " + e.Message);
                return false;
            }
            catch (ArraySizeIncorrectException e)
            {
                DispatchError(new SourcePosition(), "Bad array size: " + e.Message);
                return false;
            }

            table.UseGlobalScope();
            resolver = new TypeResolver(table);
            currFunctionReturnType = null;
            currStateInsideExpr = false;

            try
            {
                node.Accept(this);
            }
            catch (SymbolNotFoundException e)
            {
                DispatchError(e.Expr.TextPosition, e.Message);
            }

            WarnUnusedSymbols();

            return result;
        }
 public TypeResolver(SymbolTable table)
 {
     this.table = table;
 }
 public void SetSymbolTable(SymbolTable table)
 {
     this.table = table;
 }