3 ms·
Sure! I developed an interpreter for Joy in Continuation-Passing Style in Python: http://joypy.osdn.io/ http://joypy.osdn.io/ I had just implemented type infe
by carapace 8y ago
Sure! I developed an interpreter for Joy in Continuation-Passing Style in Python: http://joypy.osdn.io/ http://joypy.osdn.io/
I had just implemented type inference[1] when I got smashed over the brain by Prolog. So now the Python code is in limbo because the Prolog implementation of Joy is blindingly elegant[2].
In Prolog, the Joy interpreter is also the Joy type inferencer.[2]
The compiler (from Joy expressions to new Prolog rules) is five lines long.[2]
[1] http://joypy.osdn.io/notebooks/Types.html http://joypy.osdn.io/notebooks/Types.html
[2] https://osdn.net/projects/joypy/scm/hg/Joypy/blobs/tip/thun/thun.pl https://osdn.net/projects/joypy/scm/hg/Joypy/blobs/tip/thun/...
- garmaine 8y agoThanks! Yes, there's a real connection between concatinative languages and logic languages. In some sense you can think of a concatinative logic language as Joy with the ability to push "unknown" values onto the stack, as well as a few constraint manipulatives. That's somewhat orthogonal, but it makes sense an interpreter for Joy would be quite compact in prolog. Thanks for the links, I'll review your work later!
- carapace 8y agoCheers! You might also like: http://conal.net/papers/compiling-to-categories/ http://conal.net/papers/compiling-to-categories/ He transforms Haskell to a point-free form that's suspiciously like Joy... ;-)