[wg-camlp4] My uses of syntax extension

Fabrice Le Fessant Fabrice.Le_fessant at inria.fr
Mon Jan 28 16:44:49 GMT 2013


On 01/28/2013 05:26 PM, Leo White wrote:
>
>> In my ocaml-templates approach, the "html" parser would just receive a
>> string "<body attr=$x$> Hello, World <\body>", and call its parser,
>> that would have to understand anti-quotations, by returning a node
>> Pquotation("ocaml", "x") telling the typer that it should call the
>> ocaml parser on the string "x"...
>
> The problem with this method is that it does not support nested
> anti-quotations, or any other occurrence of the closing delimiter (the
> second "$") within the expression. You don't know whether "x" is the
> expression that needs to be parsed without asking the OCaml parser.

Of course. For that, anyway, you need a "standard" of quotations and 
anti-quotations, i.e. all parsers must obey the rule that 
anti-quotations are between $...$ and quotations between <:XXX< ... >>.
Then, you don't need to know the syntax within the (anti-)quotations, 
you can delegate parsing at the time the parsetree is needed.

--Fabrice
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fabrice_le_fessant.vcf
Type: text/x-vcard
Size: 380 bytes
Desc: not available
URL: <http://lists.ocaml.org/pipermail/wg-camlp4/attachments/20130128/b1748c41/attachment.vcf>


More information about the wg-camlp4 mailing list