3 ms·
I did that, and it was. :) I wrote some (incomplete) type inference code for Joy (a Forth-like functional language) and that (among other things) led me to Pr
by carapace 6y ago
I did that, and it was. :) I wrote some (incomplete) type inference code for Joy (a Forth-like functional language) and that (among other things) led me to Prolog. I was surprised how simple it is both syntax and semantics. ( https://joypy.osdn.io/notebooks/Types.html https://joypy.osdn.io/notebooks/Types.html ) I eventually reimplemented Joy in Prolog and discovered that the type inference code was identical to the interpreter code! ( https://git.sr.ht/~sforman/Thun/tree/master/source/thun.pl https://git.sr.ht/~sforman/Thun/tree/master/source/thun.pl )
For anyone looking to implement a Prolog Paul Tarau has an interesting approach: "A Hitchhiker’s Guide to Reinventing a Prolog Machine"
https://www.cse.unt.edu/~tarau/research/2017/eng.pdf https://www.cse.unt.edu/~tarau/research/2017/eng.pdf
- Twisol 6y ago> For anyone looking to implement a Prolog Paul Tarau has an interesting approach: Fascinating! I ended up designing my own Prolog virtual machine rather than mimicking the WAM, using a union-find address space to represent unified terms, with hopes to make it a persistent data structure and so implement backtracking over unification by cheap checkpointing. I never got around to it, but it left me with a fascination with Prolog internals.