caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Oasis and camlp4of
@ 2011-08-02 20:32 Philippe Veber
  2011-08-02 21:54 ` William Le Ferrand
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Veber @ 2011-08-02 20:32 UTC (permalink / raw)
  To: caml users

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

Hello,
how can I tell oasis that my syntax extension needs camlp4of instead of
camlp4o ? I tried to add a ByteOpt line for this:

Library pa_guizmin
  Path:               src/syntax
  Modules:            Pa_guizmin
  FindlibParent:      guizmin
  FindlibName:        syntax
  BuildDepends:       camlp4.lib, camlp4.quotations.o
  CompiledObject:     byte
  ByteOpt:            -pp camlp4of

and indeed myocamlbuild.ml now contains:

let package_default =
  {
     MyOCamlbuildBase.lib_ocaml =
       [("src/syntax/pa_guizmin", ["src/syntax"]); ("src/guizmin",
["src"])];
     lib_c = [];
     flags =
       [
          (["oasis_library_pa_guizmin_byte"; "ocaml"; "link"; "byte"],
            [(OASISExpr.EBool true, S [A "-pp"; A "camlp4of"])]);
          (["oasis_library_pa_guizmin_byte"; "ocaml"; "ocamldep"; "byte"],
            [(OASISExpr.EBool true, S [A "-pp"; A "camlp4of"])]);
          (["oasis_library_pa_guizmin_byte"; "ocaml"; "compile"; "byte"],
            [(OASISExpr.EBool true, S [A "-pp"; A "camlp4of"])])
       ];
     }
  ;;

But still, these options are not used when I compile using ocaml setup.ml-build

+ ocamlfind ocamldep -package camlp4.quotations.o -package camlp4.lib
-package camlp4.extend -modules src/syntax/pa_guizmin.ml >
src/syntax/pa_guizmin.ml.depends
File "src/syntax/pa_guizmin.ml", line 22, characters 3-5:
Error: Syntax error

Am I missing something ?

Cheers,
  Philippe.

[-- Attachment #2: Type: text/html, Size: 4774 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Oasis and camlp4of
  2011-08-02 20:32 [Caml-list] Oasis and camlp4of Philippe Veber
@ 2011-08-02 21:54 ` William Le Ferrand
  2011-08-02 22:22   ` Philippe Veber
  0 siblings, 1 reply; 5+ messages in thread
From: William Le Ferrand @ 2011-08-02 21:54 UTC (permalink / raw)
  To: Philippe Veber; +Cc: caml users

Hi

I let Sylvain detailing how things should be done properly but as a
quick hack you can add at the bottom of the _tags file <src/*.ml{,i}>:
syntax_camlp4of , it should do the trick (and it won't be erased by
oasis setup if you put it after the #OASIS_END line.

Hope it helps

William



On Tue, Aug 2, 2011 at 1:32 PM, Philippe Veber <philippe.veber@gmail.com> wrote:
> Hello,
> how can I tell oasis that my syntax extension needs camlp4of instead of
> camlp4o ? I tried to add a ByteOpt line for this:
>
> Library pa_guizmin
>   Path:               src/syntax
>   Modules:            Pa_guizmin
>   FindlibParent:      guizmin
>   FindlibName:        syntax
>   BuildDepends:       camlp4.lib, camlp4.quotations.o
>   CompiledObject:     byte
>   ByteOpt:            -pp camlp4of
>
> and indeed myocamlbuild.ml now contains:
>
> let package_default =
>   {
>      MyOCamlbuildBase.lib_ocaml =
>        [("src/syntax/pa_guizmin", ["src/syntax"]); ("src/guizmin",
> ["src"])];
>      lib_c = [];
>      flags =
>        [
>           (["oasis_library_pa_guizmin_byte"; "ocaml"; "link"; "byte"],
>             [(OASISExpr.EBool true, S [A "-pp"; A "camlp4of"])]);
>           (["oasis_library_pa_guizmin_byte"; "ocaml"; "ocamldep"; "byte"],
>             [(OASISExpr.EBool true, S [A "-pp"; A "camlp4of"])]);
>           (["oasis_library_pa_guizmin_byte"; "ocaml"; "compile"; "byte"],
>             [(OASISExpr.EBool true, S [A "-pp"; A "camlp4of"])])
>        ];
>      }
>   ;;
>
> But still, these options are not used when I compile using ocaml setup.ml
> -build
>
> + ocamlfind ocamldep -package camlp4.quotations.o -package camlp4.lib
> -package camlp4.extend -modules src/syntax/pa_guizmin.ml >
> src/syntax/pa_guizmin.ml.depends
> File "src/syntax/pa_guizmin.ml", line 22, characters 3-5:
> Error: Syntax error
>
> Am I missing something ?
>
> Cheers,
>   Philippe.
>



-- 
William Le Ferrand

Mobile : (+1) (415) 683-1484
Web : http://williamleferrand.github.com/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Oasis and camlp4of
  2011-08-02 21:54 ` William Le Ferrand
@ 2011-08-02 22:22   ` Philippe Veber
  2011-08-03  8:11     ` [Caml-list] " Sylvain Le Gall
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Veber @ 2011-08-02 22:22 UTC (permalink / raw)
  To: William Le Ferrand; +Cc: caml users

[-- Attachment #1: Type: text/plain, Size: 2556 bytes --]

Well, it seems that I have a much simpler problem (and it is not related to
camlp4of specifically): the only thing I'm missing is a '-syntax camlp4o'
when compiling the library. Indeed, adding:

<src/syntax/*>: syntax_camlp4o

at the end of _tags fixes the problem. I must have forgotten an option in
the _oasis file, but I can't see which. Anyway, many thanks William !
ph.


2011/8/2 William Le Ferrand <William.Le-Ferrand@polytechnique.edu>

> Hi
>
> I let Sylvain detailing how things should be done properly but as a
> quick hack you can add at the bottom of the _tags file <src/*.ml{,i}>:
> syntax_camlp4of , it should do the trick (and it won't be erased by
> oasis setup if you put it after the #OASIS_END line.
>
> Hope it helps
>
> William
>
>
>
> On Tue, Aug 2, 2011 at 1:32 PM, Philippe Veber <philippe.veber@gmail.com>
> wrote:
> > Hello,
> > how can I tell oasis that my syntax extension needs camlp4of instead of
> > camlp4o ? I tried to add a ByteOpt line for this:
> >
> > Library pa_guizmin
> >   Path:               src/syntax
> >   Modules:            Pa_guizmin
> >   FindlibParent:      guizmin
> >   FindlibName:        syntax
> >   BuildDepends:       camlp4.lib, camlp4.quotations.o
> >   CompiledObject:     byte
> >   ByteOpt:            -pp camlp4of
> >
> > and indeed myocamlbuild.ml now contains:
> >
> > let package_default =
> >   {
> >      MyOCamlbuildBase.lib_ocaml =
> >        [("src/syntax/pa_guizmin", ["src/syntax"]); ("src/guizmin",
> > ["src"])];
> >      lib_c = [];
> >      flags =
> >        [
> >           (["oasis_library_pa_guizmin_byte"; "ocaml"; "link"; "byte"],
> >             [(OASISExpr.EBool true, S [A "-pp"; A "camlp4of"])]);
> >           (["oasis_library_pa_guizmin_byte"; "ocaml"; "ocamldep";
> "byte"],
> >             [(OASISExpr.EBool true, S [A "-pp"; A "camlp4of"])]);
> >           (["oasis_library_pa_guizmin_byte"; "ocaml"; "compile"; "byte"],
> >             [(OASISExpr.EBool true, S [A "-pp"; A "camlp4of"])])
> >        ];
> >      }
> >   ;;
> >
> > But still, these options are not used when I compile using ocaml
> setup.ml
> > -build
> >
> > + ocamlfind ocamldep -package camlp4.quotations.o -package camlp4.lib
> > -package camlp4.extend -modules src/syntax/pa_guizmin.ml >
> > src/syntax/pa_guizmin.ml.depends
> > File "src/syntax/pa_guizmin.ml", line 22, characters 3-5:
> > Error: Syntax error
> >
> > Am I missing something ?
> >
> > Cheers,
> >   Philippe.
> >
>
>
>
> --
> William Le Ferrand
>
> Mobile : (+1) (415) 683-1484
> Web : http://williamleferrand.github.com/
>

[-- Attachment #2: Type: text/html, Size: 3837 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Caml-list] Re: Oasis and camlp4of
  2011-08-02 22:22   ` Philippe Veber
@ 2011-08-03  8:11     ` Sylvain Le Gall
  2011-08-03 12:02       ` Philippe Veber
  0 siblings, 1 reply; 5+ messages in thread
From: Sylvain Le Gall @ 2011-08-03  8:11 UTC (permalink / raw)
  To: caml-list

Hello,

On 02-08-2011, Philippe Veber <philippe.veber@gmail.com> wrote:
>
> --bcaec54ee94203b60304a98d2f09
> Content-Type: text/plain; charset=ISO-8859-1
>
> Well, it seems that I have a much simpler problem (and it is not related to
> camlp4of specifically): the only thing I'm missing is a '-syntax camlp4o'
> when compiling the library. Indeed, adding:
>
><src/syntax/*>: syntax_camlp4o
>
> at the end of _tags fixes the problem. I must have forgotten an option in
> the _oasis file, but I can't see which. Anyway, many thanks William !
> ph.
>


Indeed, you need syntax_camlp4o (which is one of the two allowed syntax
tag with syntax_camlp4r, wrt to ocamlfind). You have done exactly what
is needed to enable it (add it to _tags after OASIS section).

In fact, camlp4of is just camlp4o with extra modules:

gildor@yotta(sid-amd64/chroot):~$ camlp4of -loaded-modules
Camlp4.Printers.OCaml
Camlp4GrammarParser
Camlp4ListComprenhsion
Camlp4MacroParser
Camlp4OCamlParser
Camlp4OCamlParserParser
Camlp4OCamlRevisedParser
Camlp4OCamlRevisedParserParser
Camlp4QuotationExpander

gildor@yotta(sid-amd64/chroot):~$ camlp4o -loaded-modules
Camlp4.Printers.OCaml
Camlp4OCamlParser
Camlp4OCamlParserParser
Camlp4OCamlRevisedParser
Camlp4OCamlRevisedParserParser

You can get this extra modules, using extra tags

<src/syntax/*>: syntax_camlp4o, pkg_camlp4.gramlib, pkg_camlp4.macro

Full syntax support should be an oasis 0.3 feature.

Cheers,
Sylvain Le Gall
-- 
My company: http://www.ocamlcore.com
Linkedin:   http://fr.linkedin.com/in/sylvainlegall
Start an OCaml project here: http://forge.ocamlcore.org
OCaml blogs:                 http://planet.ocamlcore.org



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Re: Oasis and camlp4of
  2011-08-03  8:11     ` [Caml-list] " Sylvain Le Gall
@ 2011-08-03 12:02       ` Philippe Veber
  0 siblings, 0 replies; 5+ messages in thread
From: Philippe Veber @ 2011-08-03 12:02 UTC (permalink / raw)
  To: Sylvain Le Gall; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 2375 bytes --]

2011/8/3 Sylvain Le Gall <sylvain@le-gall.net>

> Hello,
>
> On 02-08-2011, Philippe Veber <philippe.veber@gmail.com> wrote:
> >
> > --bcaec54ee94203b60304a98d2f09
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > Well, it seems that I have a much simpler problem (and it is not related
> to
> > camlp4of specifically): the only thing I'm missing is a '-syntax camlp4o'
> > when compiling the library. Indeed, adding:
> >
> ><src/syntax/*>: syntax_camlp4o
> >
> > at the end of _tags fixes the problem. I must have forgotten an option in
> > the _oasis file, but I can't see which. Anyway, many thanks William !
> > ph.
> >
>
>
> Indeed, you need syntax_camlp4o (which is one of the two allowed syntax
> tag with syntax_camlp4r, wrt to ocamlfind). You have done exactly what
> is needed to enable it (add it to _tags after OASIS section).
>
> In fact, camlp4of is just camlp4o with extra modules:
>
> gildor@yotta(sid-amd64/chroot):~$ camlp4of -loaded-modules
> Camlp4.Printers.OCaml
> Camlp4GrammarParser
> Camlp4ListComprenhsion
> Camlp4MacroParser
> Camlp4OCamlParser
> Camlp4OCamlParserParser
> Camlp4OCamlRevisedParser
> Camlp4OCamlRevisedParserParser
> Camlp4QuotationExpander
>
> gildor@yotta(sid-amd64/chroot):~$ camlp4o -loaded-modules
> Camlp4.Printers.OCaml
> Camlp4OCamlParser
> Camlp4OCamlParserParser
> Camlp4OCamlRevisedParser
> Camlp4OCamlRevisedParserParser
>
I see, thanks for the explanation.


>
> You can get this extra modules, using extra tags
>
> <src/syntax/*>: syntax_camlp4o, pkg_camlp4.gramlib, pkg_camlp4.macro
>

Thanks William, Christophe and Sylvain !
The solution suggested by William is not that hackish, and I'm pretty happy
with it. That's incredible how oasis (with findlib and ocamlbuild) has made
starting an ocaml project easier.


>
> Full syntax support should be an oasis 0.3 feature.
>
That is very good news.
Many thanks again,
ph.



>
> Cheers,
> Sylvain Le Gall
> --
> My company: http://www.ocamlcore.com
> Linkedin:   http://fr.linkedin.com/in/sylvainlegall
> Start an OCaml project here: http://forge.ocamlcore.org
> OCaml blogs:                 http://planet.ocamlcore.org
>
>
>
> --
> 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
>
>

[-- Attachment #2: Type: text/html, Size: 3979 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-03 12:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02 20:32 [Caml-list] Oasis and camlp4of Philippe Veber
2011-08-02 21:54 ` William Le Ferrand
2011-08-02 22:22   ` Philippe Veber
2011-08-03  8:11     ` [Caml-list] " Sylvain Le Gall
2011-08-03 12:02       ` Philippe Veber

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).