Version française
Home     About     Download     Resources     Contact us    
Browse thread
building executables with camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jeremy Yallop <jeremy.yallop@e...>
Subject: Re: [Caml-list] building executables with camlp4
Thanks for the help, Nicolas.  I think I'm getting somewhere.  I no
longer get Not_found, but now my grammar extension doesn't seem to be
activated.

Here's a fairly minimal example:

File minimal.ml:

     open Camlp4.PreCast.Syntax

     DELETE_RULE Gram str_item: "type"; type_declaration END

     EXTEND Gram
     str_item:
     [[ "type"; types = type_declaration ->
           <:str_item< type $types$ >>
      | "type"; types = type_declaration;
        "premiums" ; "(" ; "squigglier" ; ")" ->
           prerr_endline "squigglier!";
           <:str_item< type $types$ >>  ]];
     END

File input.ml:

     type x = int premiums ( squigglier )

This works:

      $ ocamlc -c -pp camlp4of  \
        -I /usr/local/ocaml/lib/ocaml/camlp4 minimal.ml
      $ camlp4o minimal.cmo input.ml
      squigglier!
      type x = int

But this doesn't:

      $ ocamlc -g -linkall -I /usr/local/ocaml/lib/ocaml/camlp4  \
        -o minimal \
        camlp4lib.cma \
        unix.cma \
        Camlp4Parsers/Camlp4OCamlRevisedParser.cmo \
        Camlp4Parsers/Camlp4OCamlParser.cmo \
        Camlp4Printers/Camlp4OCamlPrinter.cmo \
        Camlp4Bin.cmo \
        minimal.cmo
      $ ./minimal input.ml
      File "input.ml", line 1, characters 35-36:
      Parse error: ident_of_ctyp: this type is not an identifier

What should my linking command be for this to work?

Jeremy.