[Haskell-cafe] Writing a compiler in Hakell

Mads Lindstrøm mads_lindstroem at yahoo.dk
Sat May 9 05:36:26 EDT 2009


Hi Doaitse

Doaitse Swierstra wrote:
> Dear Rouan,
> 
> on
> 
> http://www.cs.uu.nl/wiki/HUT/WebHome
> 
> you will find a collection of tools which may help you to construct
> a  
> compiler. As an example you will find a Tiger compiler constructed  
> with the uulib tools and the uuagc attribute grammar system. Tiger
> is  
> 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
> the  
> 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
audiences.

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 [1] it seems very sparse.
Compared to Parsec, I miss a lot of the standard combinators [2]. 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.


Kind regards,

Mads Lindstrøm


[1]
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uu-parsinglib
[2]
http://hackage.haskell.org/packages/archive/parsec/3.0.0/doc/html/Text-Parsec-Combinator.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
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 mailing list