
from values import *
from functionvalues import EeyFunction

class EeyRuntimePrint( EeyValue ):
    def __init__( self, args ):
        EeyValue.__init__( self )
        self.args = args

    def construction_args( self ):
        return ( self.args, )

class EeyPrint( EeyFunction ):

#    def __init__( self ):
#        EeyFunction.__init__( self, ( ( EeyAny, EeySymbol( "object" ) ), ) )

    def construction_args( self ):
        return ()

    def call( self, env, args ):
        return EeyRuntimePrint( args )

    def return_type( self, env, args ):
        return EeyType( EeyNoneType )

    def args_match( self, args ):
        return True # Print accepts anything


class EeyRuntimeLen( EeyValue ):
    def __init__( self, args ):
        EeyValue.__init__( self )
        if( len( args ) != 1 ):
            raise UserErrorException(
                "There should only ever be one argument to len()" )
        self.arg = args[0]

    def construction_args( self ):
        return ( (self.arg,), )

    def do_evaluate( self, env ):
        # TODO: if it's known, do it
        return self

    def is_known( self ):
        # TODO: if it's known, return True
        return False

class EeyLen( EeyFunction ):
    def construction_args( self ):
        return ()

    def get_fn( self, args, env ):
        return self

    def call( self, env, args ):
        return EeyRuntimeLen( args )

    def return_type( self, env, args ):
        return EeyType( EeyInt )

    def args_match( self, args ):
        return True # TODO


def add_builtins( env ):
    # Statements
    env.namespace["pass"] = EeyPass()

    # Values
    env.namespace["False"] = EeyBool( False )
    env.namespace["True"]  = EeyBool( True )

    # Types
    env.namespace["bool"]  = EeyType( EeyBool )
    env.namespace["float"] = EeyType( EeyFloat )
    env.namespace["int"]   = EeyType( EeyInt )
    env.namespace["string"]= EeyType( EeyString )
    env.namespace["void"]  = EeyType( EeyVoid )
    env.namespace["type"]  = EeyType( EeyType )

    # Functions
    env.namespace["len"]   = EeyLen()
    env.namespace["print"] = EeyPrint()



from values import *
from functionvalues import EeyFunction

class EeyRuntimePrint( EeyValue ):
    def __init__( self, args ):
        EeyValue.__init__( self )
        self.args = args

    def construction_args( self ):
        return ( self.args, )

class EeyPrint( EeyFunction ):

#    def __init__( self ):
#        EeyFunction.__init__( self, ( ( EeyAny, EeySymbol( "object" ) ), ) )

    def construction_args( self ):
        return ()

    def call( self, env, args ):
        return EeyRuntimePrint( args )

    def return_type( self, env, args ):
        return EeyType( EeyNoneType )

    def args_match( self, args ):
        return True # Print accepts anything


class EeyRuntimeLen( EeyValue ):
    def __init__( self, args ):
        EeyValue.__init__( self )
        if( len( args ) != 1 ):
            raise UserErrorException(
                "There should only ever be one argument to len()" )
        self.arg = args[0]

    def construction_args( self ):
        return ( (self.arg,), )

    def do_evaluate( self, env ):
        # TODO: if it's known, do it
        return self

    def is_known( self ):
        # TODO: if it's known, return True
        return False

class EeyLen( EeyFunction ):
    def construction_args( self ):
        return ()

    def call( self, env, args ):
        return EeyRuntimeLen( args )

    def return_type( self, env, args ):
        return EeyType( EeyInt )

    def args_match( self, args ):
        return True # TODO


def add_builtins( env ):
    # Statements
    env.namespace["pass"] = EeyPass()

    # Values
    env.namespace["False"] = EeyBool( False )
    env.namespace["True"]  = EeyBool( True )

    # Types
    env.namespace["bool"]  = EeyType( EeyBool )
    env.namespace["float"] = EeyType( EeyFloat )
    env.namespace["int"]   = EeyType( EeyInt )
    env.namespace["string"]= EeyType( EeyString )
    env.namespace["void"]  = EeyType( EeyVoid )
    env.namespace["type"]  = EeyType( EeyType )

    # Functions
    env.namespace["len"]   = EeyLen()
    env.namespace["print"] = EeyPrint()


Remove get_fn function added in error.