[Haskell-cafe] looking for alex+happy examples that uses location annotated tokens and location information in err msgs

Stephen Tetley stephen.tetley at gmail.com
Sun Mar 9 20:47:53 UTC 2014


Hi Ömer

Are you rewriting Eijiro Sumii's MinCaml in Haskell?

I did the same a couple of years ago, though I used Parsec for parsing
and only implemented the higher transformations (beta reduction,
inlining, constant folding, useless variable elimination). As I have
no access to a Sparc machine, I didn't go as far as closure conversion
and code generation.

The code was only for my personal learning as MinCaml was the nicest /
smallest real compiler I could find. Code is in my Google repository -
it might be useful for reference, obviously for a learning exercise
you'd want to do-it-yourself:

https://code.google.com/p/copperbox/source/browse/  >> trunk >>
compiler >> HMinCaml

Best wishes

Stephen

On 9 March 2014 19:18, Ömer Sinan Ağacan <omeragacan at gmail.com> wrote:

[Snip]

>
> Working code:
> * Lexer(Alex): https://github.com/osa1/minCaml.hs/blob/master/src/Lexer.x
> * Parser(Happy): https://github.com/osa1/minCaml.hs/blob/master/src/Parser.y
>


More information about the Haskell-Cafe mailing list