language.c: support for statements in MonadTrav

Alexander Bernauer bernauer at inf.ethz.ch
Tue Feb 8 09:08:29 GMT 2011


Hi Aaron

On Sat, Feb 05, 2011 at 02:54:21PM -0800, Aaron Tomb wrote:
> I considered the possibility of adding code to dive into statements,
> but I generally prefer the idea of using generic programming libraries
> for that sort of thing.

In the meanwhile I must say that I do agree. 

I had to go through the "write your boilerplate code manually"-hell
first in order to understand ;-)
 
> For traversal of statements and expressions, I've had success doing
> generic programming with Uniplate, which is sufficient for everything
> I've needed, and purely static. As a result, it's almost as efficient
> as a hand-written traversal, and will never fail at runtime.

Hmm, sound's interesting.

The project home page [1] seems to be down, though. 

> https://github.com/atomb/language-c-uniplate

The PlateDirect documentation [2] recommends using Uniplate.Direct. And
Uniplate is marked as deprecated [3] and refers to UniplateStr which
in turn recommends [4] Uniplate.Operations which you should not use
directly [5] but import Uniplate.Direct instead. Is this me or is this
confusing?

What is the reason why you have chosen PlateDirect?

And is it maybe possible to generate the Plate instances with DrIFT [6]?

Nevertheless, I am looking forward to your release. It will relieve me
from manually traversing the ASTs.

> I haven't completely tied in the code to build a full
> symbol table yet, but I don't think there's much work left to be done.

So, do you plan to include this into the upcoming release?
 
> The existing code will build up a map containing information about all
> global declarations, but my idea is to extend that to include local
> declarations, as well, to make it useful when doing repeated traversal
> of statements and expressions within function bodies.

Yeah, that sounds good.

If I can be of any help please let me know.

best

Alex

[1] http://www-users.cs.york.ac.uk/~ndm/uniplate/
[2]
http://hackage.haskell.org/packages/archive/uniplate/1.6/doc/html/Data-Generics-PlateDirect.html
[3]
http://hackage.haskell.org/packages/archive/uniplate/1.6/doc/html/Data-Generics-Uniplate.html
[4]
http://hackage.haskell.org/packages/archive/uniplate/1.6/doc/html/Data-Generics-UniplateStr.html
[5]
http://hackage.haskell.org/packages/archive/uniplate/1.6/doc/html/Data-Generics-Uniplate-Operations.html
[6] http://repetae.net/computer/haskell/DrIFT/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://projects.haskell.org/pipermail/language-c/attachments/20110208/7b91b7a5/attachment.pgp>


More information about the Language-c mailing list