Hi,

Is it possible for Camlp4 to implement an OCaml syntax extension (i.e.
pa_*) which modifies the lexer of OCaml syntax?

I have tried to override whole the syntax as follows, but it seems
that it changes nothing...:

-----------------------------------------------------------
open Camlp4

module Id : Sig.Id = struct
  let name = "pa_extlex"
  let version = "1.0"
end

module XLexer = Xlexer.Make(PreCast.Token)        (* XLexer
reimplements OCaml lexer with some extra rules *)
module XGram = PreCast.MakeGram(XLexer)

module Make (Syntax : Sig.Camlp4Syntax) = struct
  let _ = prerr_endline "Creating OCaml syntax with lexer extension"
  module M1 = OCamlInitSyntax.Make(PreCast.Ast)(XGram)(PreCast.Quotation)
  module M2 = Camlp4OCamlRevisedParser.Make(M1)
  module M3 = Camlp4OCamlParser.Make(M2)
  include M3
end

let module M = Register.OCamlSyntaxExtension(Id)(Make) in ()
-----------------------------------

Jun

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to