[wg-camlp4] On domain-specific foreign syntaxes

Leo White lpw25 at cam.ac.uk
Thu Jan 31 18:04:55 GMT 2013


>Ok, so:
>   {:lid x|..|x}
>is strictly equivalent to:
>   {:lid {x{...}x} }
>?
>
>Also also equivalent to:
>   {:lid "..."}
>as long as the string "..." does not contain any special character?
>
>(i.e. the various forms are not distinguished in the Parsetree.)

This comes back to how we feel about syntactic sugar in the Parsetree. 
Personally I like keeping things separate if they look different, but not 
if it involves too much hassle.

> (I find the choice of |
>as part of a delimiter cognitively dangerous since it is usually used as 
>in separator in OCaml syntax).

I would be perfectly happy with "<" + ">" instead of |, or anything else 
which doesn't interfere with the {:lid expr } syntax. As long as its a 
single-character and it is not "{" + "}".

> (I will just cross my fingers so that the developers of tools 
>I'll like to use don't force me to use concrete syntax + anti-quotations 
>for no good reason.)

Considering a parser is probably more effort to write than an AST 
transformer, I don't think you need to worry too much. If it can be done 
sensibly without concrete syntax (i.e it is not a "foreign syntax") it 
probably will be. And of course there is nothing to stop conscientious 
extension authors from providing both styles.



More information about the wg-camlp4 mailing list