First release of Shed Skin, a Python-to-C++ compiler.

Discussion in 'Python' started by Mark Dufour, Sep 12, 2005.

  1. Mark Dufour

    Mark Dufour Guest

    First the good news: ShedSkin (SS) more or less works on Windows. After
    Thank you so much for your efforts! I will try to download your
    patches this afternoon on a roommate's Windows computer, and try to
    see if I can fix the remaining tests.
    Thanks!! Since adding GC support took about 10 lines of C++ code, I
    guess it won't be hard to switch to a different system.. I'll try and
    see if I can add support for a version that works with Win98..

    BTW if anyone is interested in running Shed Skin under OSX.. I got
    this comment on my blog (http://shed-skin.blogspot.com)

    (why doesn't everybody just run Gentoo? :p)
    sets_.cpp >random_.cpp math_.cpp copy_.cpp -lgc -lm
    OS X (in my >case, I just had to put /usr/local at the start of my
    path)

    thanks!
    mark.
     
    Mark Dufour, Sep 12, 2005
    #1
    1. Advertisements

  2. Mark Dufour

    A.B., Khalid Guest


    Don't mention it.

    Okay. An update.

    - Test (124, 'small factorization program by Rohit Krishna Kumar') now
    passes on Windows. My mistake in my patching of SS header files. The
    patch is now updated. Please download again if you have an earlier
    copy.

    - Test (122, 'neural network simulator XXX later: recursive
    customization, plus some small fixes') was not really failing, it was
    just not passing. :)

    You see the Python version calls random like so:
    self.weight = (random()-0.5)/2 # [float]

    And testing output for random generated values is not going to make the
    test pass. So if we change that line to a random value generated by
    Python in the same way like so:
    self.weight = (0.88996634365870131-0.5) # [float]

    We have then output from Python like so:
    [[0.97483328216510368], [0.50575070454495774], [0.50047176765739709],
    [0.93429133063585856], [0.50083898389362214], [0.98098364981984132],
    [0.5033858371718114], [0.94838636704849744], [0.50002510730868799],
    [0.50910910041727786], [0.5128172933740105], [0.50010155471769424]]


    and from the compiled SS generated C++ files like so:
    [[0.974833], [0.505751], [0.500472], [0.934291], [0.500839],
    [0.980984], [0.503386], [0.948386], [0.500025], [0.509109], [0.512817],
    [0.500102]]

    Which is okay I guess, wouldn't you agree?

    - On to Test (85, 'ifa: mixing strings and lists of strings in the same
    list'). It is still failing. It is crashing in the compiled C++
    generated from SS. But did you know that the test in pure Python is
    crashing as well?

    """
    #test03.py
    #('ifa: mixing strings and lists of strings in the same list', '''
    def row_perm_rec():
    hoppa_row = 'impossible' # [str]
    hoppa_row = [] # [list(str)]

    a = hoppa_row # [pyobj]
    hoppa_row.extend(a) # []
    hoppa_row.append('u') # []

    return hoppa_row # [pyobj]

    a = [[7]] # [list(list(int))]
    s = row_perm_rec() # [pyobj]
    puzzleboard = [['']] # [list(list(str))]
    puzzleboard[1][1] = s[1] # [str]
    #''', '''
    #check('s', ['pyobj'])
    #check('a', ['list(list(int))'])
    #check('puzzleboard', ['list(list(str))'])
    #output()
    """



    Running that file produces this error in all Python versions I have.:
    Traceback (most recent call last):
    File "test03.py", line 15, in ?
    puzzleboard[1][1] = s[1] # [str]
    IndexError: list index out of range



    - Finally Test (60, '__class__ and __name__ attributes') needs
    patience. :) In Python it outputs the following:
    __main__.evert
    evert
    <type 'instance'>
    instance
    equal str!


    In the compiled C++ generated by SS it outputs the following:
    class evert
    evert
    class evert
    evert
    equal!
    [Big nasty crash]



    So there. :)


    Regards,
    Khalid
     
    A.B., Khalid, Sep 13, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.