5 ms·
The Programming Languages Zoo really helped me in learning type inference implementation. It has a series of increasingly complex languages, all implemented in
by glutamate 12y ago
The Programming Languages Zoo really helped me in learning type inference implementation. It has a series of increasingly complex languages, all implemented in ML.
http://andrej.com/plzoo/ http://andrej.com/plzoo/
- dwenzek 12y agoIn the same vein you have this site [1], with misc type related algorithms and implementations in OCaml . [2] is a paper with a modula-2 implementation. Written by Luca Cardelli, a type fellow, it really helped me to understand type inference. [1] https://github.com/tomprimozic/type-systems https://github.com/tomprimozic/type-systems. [2] http://lucacardelli.name/Papers/BasicTypechecking.pdf http://lucacardelli.name/Papers/BasicTypechecking.pdf
- kjs3 12y agoYeah...pretty much anything mentioning Cardelli needs an upvote. He's a brilliant guy and a very clear, understandable writer.
- cabalamat 12y ago> The Programming Languages Zoo I don't suppose you know of an equivalent written in Haskell, do you?
- gelisam 12y agoSounds like fun, let's write one!
- glutamate 12y agoA lot of the code in the PL Zoo is very readable and translates straight to Haskell. I mean look at this stuff: http://andrej.com/plzoo/html/miniml.html http://andrej.com/plzoo/html/miniml.html you can almost translate that with an emacs macro. Except for the parsing stuff, which is some OCaml specific parser generator.
- cabalamat 12y ago> you can almost translate that with an emacs macro If I knew Haskell, I expect I could. However I am currently learning Haskell, which is why I'd be interested in a repository of example language implementations in Haskell. > some OCaml specific parser generator Which looks quite nice, and is evidently modelled on yacc/lex. People rave about Haskell's Parsec but TBH I'm finding it a bit unintuitive.
- glutamate 12y agoThere is Happy and Alex for Haskell, and also some older tools like Frown and BNFC. But the coolest thing about Parsec is that you can construct the parser at run-time, for instance calculating it after scanning a file for infix declarations. If you want custom infix in a yaccy grammar, you have to walk the AST afterwards to fix the application precedence.
- jozefg 12y agoIt's not a bad skill to be able to read SML/OCaml. They're really very similar to Haskell and actually pretty fun to write. I suppose you could have inferred (ha) I feel that way from this blog post though :)