[wg-camlp4] Matching on concrete syntax (was: Re: Camlp4 uses)

Alain Frisch alain at frisch.fr
Tue Jan 29 16:22:38 GMT 2013


On 01/29/2013 04:37 PM, Xavier Clerc wrote:
> However, during development,
> it was a time-saver to be able to easily express and experiment new
> ideas by manipulating "bits of the actual language". Camlp4 was kind
> enough to translate them for me into AST code which I had to check.

What about having a tool (either stand-alone or part of the compilers) 
which dumps the Parsetree representation of some code fragment in as 
textual OCaml values (probably without locations)?

So you can type your "model" as source code and obtain quickly the 
Parsetree representation, copy/paste it into a nice pattern and replace 
some parts with variables.

Alain



More information about the wg-camlp4 mailing list