Combining camlp4 and camlp5 in -pp for ocamlopt?

I want to combine BOLT, SEXP and ocamlViz for a large project. The problem is that SEXP and BOLT use CamlP4, and ocamlviz uses camlp5. But how could I chain calls into the -pp ocamlc / ocamlopt argument?

Here is my call for a real project without ocamlviz: ocamlopt.opt -c -I + dynlink -I + bolt -I + threads -I + lablgtk2 -I + extlib -I + pcre -I + netsys -I + netstring -I + json -wheel -I + num -I + nums -I + sexplib -I + zip -I + xml-light -I + xmlrpc-light -I + equeue -I + netclient -g -annot -p -thread -pp 'camlp4o /usr/lib/ocaml/bolt/bolt_pp.cmo -logger '\' 'foo.native' \ '' -level DEBUG - -I / usr / lib / ocaml / sexplib -I / usr / lib / ocaml / type- conv pa_type_conv.cmo pa_sexp_conv.cmo '-o foo.cmx foo.ml

+3
source share
2 answers

It is impossible to pre-process the source file with two different preprocessors at the same time for obvious reasons, and using one after the other is also impossible, because the first does not recognize the syntax intended for the second. The solution is to either use different syntaxes in different source files, or the ocamlviz port for camlp4.

+1
source

If you pass -printer OCamlin Camlp4, it will output the pre-processed O'Caml file in its original format. Then you can parse this file again with Camlp5 in another step.

0
source

All Articles