[wg-camlp4] Editor support for syntax extensions

Alain Frisch alain at frisch.fr
Wed Jan 30 14:21:20 GMT 2013


On 01/30/2013 12:19 PM, Török Edwin wrote:
> I still get syntax highlighting and matching parens in both vim and emacs for the above (although maybe antiquotations would confuse it):

Highlighting gets completely wrong as soon as you start e.g. using 
double quotes. And indentation is just impossible if the editor isn't 
aware of the grammar implemented by the extensions.  One could certainly 
try to fix this and introduce more tools, complexity and border cases. 
But I still fail to see the real benefits of allowing very customized 
syntax which would justify such efforts.  The whole point of -ppx versus 
camlp4 is precisely to stop messing up with the concrete syntax: define 
some generic enough extension points, and just work with a fixed 
concrete syntax.  I'd prefer to see dead simple solutions adopted for 
-ppx, and more advanced stuff (based on concrete syntax) left to camlp4/fan.

> 4. What syntax extensions to use => define in the source code
>
> This has already been mentioned that the source file could define what syntax extensions it uses, so it works for all build systems (ocamlbuild, makefiles, omake), etc.
> It may not even need special support from the compiler: there could be a -ppx that finds these pragmas and loads those other -ppx on its own!

I've started something along these lines:

https://github.com/alainfrisch/ppx_drivers

Exactly how this works with ocamlfind needs to be discussed.  I know 
Gerd has some ideas!


Alain


More information about the wg-camlp4 mailing list