[wg-camlp4] My uses of syntax extension
Leo White
lpw25 at cam.ac.uk
Mon Jan 28 21:01:12 GMT 2013
>3 parsers actually.
>The original parser, the parser to patt, the parser to expr.
The original parser isn't necessary for the quotation, and of course the
other two parsers are only both needed if you want the quotation to work as
both a pattern and an expression.
Anyway, my point is that you do not *need* to implement quotations by
parsing to a value and then converting to an AST fragment, in fact it is
often easier not to.
That is not to say that some people might not want to implement their
quotations by parsing to a value and then converting to an AST fragment. In
fact, if they want to use an external parser (over which they have little
control) to parse their quotations then they may have to do it that way.
For these cases I think there are three options:
1. They can implement conversion functions by hand.
2. They could use some kind of type-conv style extension to automatically
produce the conversion functions. I'm sure such an extension would be
welcomed by other extension authors.
3. If/when some kind of run-time type representation is added to the
language, it could be used to create a generic conversion function.
More information about the wg-camlp4
mailing list