public Ast.Code ParseCode()
        {
            var code = new Ast.Code
            {
                Statements = new List <Ast.IStatement>()
            };

            while (!CurTokenIs(TokenType.Eof))
            {
                var statement = ParseStatement();
                if (statement != null)
                {
                    code.Statements.Add(statement);
                }
                NextToken();
            }

            return(code);
        }
        private static IObject EvalCode(Ast.Code code, Environment env)
        {
            IObject result = null;

            foreach (var s in code.Statements)
            {
                result = Eval(s, env);

                if (result == null)
                {
                    continue;
                }
                if (result.getType() == Type.Return)
                {
                    return(((Return)result).Value);
                }
                else if (result.getType() == Type.Error)
                {
                    return(result);
                }
            }

            return(result);
        }