caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* question about camlp4 and lexer
@ 2006-08-18 17:32 Christophe Raffalli
  0 siblings, 0 replies; only message in thread
From: Christophe Raffalli @ 2006-08-18 17:32 UTC (permalink / raw)
  To: caml-list


Hello,

For a camlp4 extension, I want to add some delimiters:
  (^  ^)  [^ ^] {^ ^} [|^ ^|].

It does not break anything and it works quite well ... my problem is
that I find it a bit hard to compile the camlp4 extension.
Here is a part of my Makefile:

# compilation of the lexer
mylexer.cmo: mylexer.ml
    $(CAMLC) -pp "camlp4r -loc _loc"  -I +camlp4 -c mylexer.ml

# recompilation of pa_o.ml (unmodified and directly copied from the
source of ocaml)
pa_o.cmo: pa_o.ml mylexer.cmo
    $(CAMLC) -pp "camlp4r pa_extend.cmo q_MLast.cmo -loc _loc"  -I
+camlp4 -c pa_o.ml

# my syntax extension
pa_bindlib.cmo: bindlib.cmi pa_bindlib.ml pa_o.cmo
    $(CAMLC) -pp "camlp4 ./mylexer.cmo ./pa_o.cmo pa_extend.cmo
q_MLast.cmo pr_dump.cmo -loc _loc"  -I +camlp4 -c pa_bindlib.ml

# linking of a camlp4 preprocessor
camlp4bo: pa_bindlib.cmo
    $(CAMLC) -linkall -I +camlp4 odyl.cma camlp4.cma ./mylexer.cmo
./pa_o.cmo pa_bindlib.cmo pr_dump.cmo odyl.cmo -o camlp4bo


I do not understand why I need to recompile pa_o.ml and cannot use
pa_o.cmo in "ocaml/camlp4" (I tried but it uses the original lexer and
not mine) ...
This is a bit annoying and I am probably doing something wrong ...

Thanks in advance for you help,
Christophe Raffalli


By the way, I think the default lexer should consider (xxx xxx) [xxx
xxx] {xxx xxx} as delimiters whenever xxx is an infix keyword ... so
camlp4 user would have a big choice of delimiters ...


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-08-18 17:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-18 17:32 question about camlp4 and lexer Christophe Raffalli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).