public override bool Visit(AstProgram node)
        {
            ErrorIfIsNull(node);
            ErrorIfIsNull(node.Class);

            return true;
        }
        public bool Check(AstProgram rootNode)
        {
            result = true;
            rootNode.Accept(this);

            return result;
        }
 public override bool Visit(AstProgram node)
 {
     table.UseGlobalScope();
     SaveStringConstants();
     CreateLLVMBuiltIn();
     return true;
 }
        public SymbolTable Build(AstProgram node)
        {
            table = new SymbolTable();

            AddBuiltInSymbols();
            node.Accept(this);

            return table;
        }
 public bool TestTree(AstProgram node)
 {
     try
     {
         node.Accept(this);
     }
     catch (InvalidAstException)
     {
         return false;
     }
     return true;
 }
        public override bool Generate(AstProgram astRootNode, Stream outStream)
        {
            stringLiteralCounter = 0;
            var findStringsVisitor = new FindAllStringConstantsVisitor();
            stringConstants = findStringsVisitor.FindAll(astRootNode);

            codeStream = new StreamWriter(outStream);
            codeStream.AutoFlush = true;
            astRootNode.Accept(this);
            codeStream.Flush();
            return true;
        }
        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 override bool Visit(AstProgram node)
 {
     table.UseGlobalScope();
     return true;
 }
        // #PS_PROGRAM #CLASS_DEF EOF
        private void ConstructPsProgram()
        {
            var astClass = nodes.Pop() as AstClass;
            var program = new AstProgram(astClass);
            rootNode = program;

            if (nodes.Count > 0)
            {
                throw new Exception("bad code detected.");
            }
        }
 // http://en.wikipedia.org/wiki/Shunting-yard_algorithm
 public AstBuilder()
 {
     rootNode = null;
     nodes = new Stack<AstNode>();
 }
 public List<string> FindAll(AstProgram root)
 {
     result = new List<string>();
     root.Accept(this);
     return result;
 }
 public override bool Visit(AstProgram node)
 {
     return true;
 }
 public abstract bool Generate(AstProgram astRootNode, Stream outStream);
 public abstract bool Visit(AstProgram node);