Using OCaml syntax extension in Camlp4 with ocamlbuild -


i having issue using deriving-ocsigen syntax extension in camlp4 parser. parser called pa_debug.ml

here's tags file:

<pa_debug.ml>: pp(camlp4orf.opt), package(deriving-ocsigen.syntax), syntax(camlp4o) 

when compiled with

ocamlbuild -libs dynlink,camlp4lib,deriving -cflags -i,+camlp4,-dtypes -lflags -i,+camlp4,-dtypes -use-ocamlfind pa_debug.cmo 

i following error:

warning: -pp overrides effect of -syntax partly file "pa_debug.ml", line 103, characters 66-67: while expanding quotation "expr" in position of "expr": parse error: [expr] expected after [infix operator (level 0) (comparison operators, , others)] (in [expr]) 

the error occurs in second line of snippet of code:

... let fun_id = get_fun_id bi in let app = <:expr< debug.ho_1 $str:fun_id$ (show.show<int>) (show.show<int>) >> in let debug_fun_body = mk_appln _loc app new_patts in ... 

in code, typing use deriving's syntax in quotation. seems preprocessor not understand presence of "<" , ">" comparison operators in quotation. if use show.show<int> syntax in file without quotations, compiles without errors.

i've seen solution fix -pp overrides effect of -syntax problem don't understand it. can please explain me or suggest other way fix it?

now posted code snippet, believe problem use of camlp4 extensions inside quotations. need check whether that's allowed in general case (there question of whether quotation parser uses predefined parser, or extended previous extensions passed compiler), of whether particular extension you're using works revised syntax, use through invocation of camlp4orf (or means ambient code in original syntax, while in-quotation code in revised syntax, preferred in quotations because less ambiguous -- f means "full", usual extensions (stream parsers, etc.) activated).

if "deriving" wasn't thought used in revised syntax, revised quotations may not work @ all. in case, problem specific camlp4, rather ocamlbuild-related.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -