[Haskell-cafe] Writing a compiler in Hakell
mads_lindstroem at yahoo.dk
Sat May 9 05:36:26 EDT 2009
Doaitse Swierstra wrote:
> Dear Rouan,
> you will find a collection of tools which may help you to construct
> compiler. As an example you will find a Tiger compiler constructed
> with the uulib tools and the uuagc attribute grammar system. Tiger
> the language used in the book series by Andrew Apple. Not that Tiger
> is a great language, but the compiler contains an instance of all
> things that have to be done when writing a compiler.
> Once you like these tools you may take a look at the UHC compiler,
> which actually is a series of compilers, starting from a small
> language, which is than gradually extended, both with new language
> concepts and with new aspects, such as code generation, new forms of
> types etc. Here you will also see that writing a compiler for a
> language like Haskell is not a small endeavour.
I tried the uu-parsinglib and must admit, that I got a bit frustrated.
In my rant below I may sound very negative, but that is not my
intention. My intention is to give you my initial impression of the
rough spots when trying uu-parsinglib, which you may (or may not) use if
you want to make uu-parsinglib more newcomer friendly.
First the 55 page document "Combinator Parsing: A Short Tutorial" has,
in my mind, some shortcoming:
* A 55 page document should have a table of contents. It helps people
understand the structure, and makes the document easier to navigate.
* It is not really a tutorial! Or at least, not a tutorial that gets you
quickly writing parses using uu-parselib. It describes alternative
implementation, why something is implemented in a particular way, how
something is implemented, ... These are all good things, but not
something that helps me get started. They belong in an advanced section.
Or maybe it would be better with two documents, with different target
Furthermore, the Tiger example is good. But please provide type
signatures for all functions. The signatures may be obvious to you, but
for the newcomer they may not be.
When I look at the uu-parselib interface  it seems very sparse.
Compared to Parsec, I miss a lot of the standard combinators . It
seems like you have to implement those combinators yourself.
Finally, there is no Haddock documentation in uu-parselib.
The lack of entry-level documentation and few predefined parsing
combinators in uu-parselib do make for a steep learning curve.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090509/3d39e701/attachment.bin
More information about the Haskell-Cafe