[Haskell-cafe] Syntax macros

Doaitse Swierstra doaitse at cs.uu.nl
Sat May 15 22:29:04 EDT 2004


We have all the machinery available. See:

http://www.cs.uu.nl/groups/ST/Center/SyntaxMacros

It will be part of the UtrechtHaskellCompiler (UHC), that is being 
constructed with our toolset, and which recently strated to produce 
running code. You get the syntax macros "almost" for free if you build 
your parser with the UtrechtParserCombinators (UPC).  You can 
experiment with it yourself for your own language.

The probem we are still working on is to handle left-recursive 
extensions being made by the user. We are well on our way with that. In 
principle we also know how to provide feedback to the user in terms of 
the extended input language, but unfortuantely the implementation is 
rather cumbersome.

  Doaitse


On 2004 mei 15, at 17:49, Per Larsson wrote:

> I have recently made a small detour into ocaml programming and I'm 
> rather
> impressed with the generic preprocessor 'camlp4' for ocaml. Camlp4 
> allows the
> programmer to (i) interact with the ocaml parser and lexer to extend 
> the
> concrete grammar with new syntax and (ii) to directly define the 
> translation
> of such new syntax forms in terms of ocaml abstract syntax. Haskell
> programmers (at least in GHC) can also manipulate abstract syntax with 
> the
> Template Haskell extension and the Language.Haskell.THSyntax library, 
> but to
> my knowing there is no haskell compiler which supports the inclusion 
> of new
> syntax forms. Wouldn't such a tool be cool? In the haskell community 
> there
> are a number of handmade preprocesserors (DrIFT, Generic Haskell, 
> HaRP, ...)
> which  are both cumbersome to write, because the authors must write a
> (partial) haskell parser for every small extension, but also 
> cumbersome to
> use because of increasing complexity to your makefiles and different
> standards for error reporting. Also, experimental extensions could 
> quickly be
> written and evaluated by the haskell users, decreasing the dependency 
> on the
> compiler maintainers.
>
> Per Larsson
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list