From: hmf@inescporto.pt
To: Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Ocamlbuild + menhir + separate token file
Date: Sat, 9 Aug 2008 09:11:57 +0100 [thread overview]
Message-ID: <1218269517.489d514dbef99@webmail.inescporto.pt> (raw)
Hi,
This is just to add one of the errors I get that seems to indicate
something is wrong when ocamlbuild passes flags. The line below
shows how invalid flags are passed on repeatedly (simply remove
the dep lines from the myocamlbuild file sent earlier):
/home/hugof/ocaml/godi/bin/menhir --external-tokens Tokens tokens.mly
--base parser --raw-depend --ocamldep
'/home/hugof/ocaml/godi/bin/ocamldep.opt --external-tokens Tokens
tokens.mly --base parser -pp '\''--external-tokens Tokens tokens.mly
--base parser'\'' -modules' parser.mly > parser.mly.depends
/home/hugof/ocaml/godi/bin/ocamldep.opt: unknown option `--external-tokens'.
Usage: ocamldep [options] <source files>
...
Thanks,
Hugo F.
hmf@inescporto.pt wrote:
> Hello,
>
> While working on some parser stuff I had some compilation errors.
> I am attempting to use a lexer whose tokens are shared by two
> parsers implemented using Menhir. This has already been done
> and for the life of me I cannot reproduce the results in [1].
>
> So I have used menhir's demos (calc-param) [2] to try and set-up
> a small and very simple build process. The source code consists of:
>
> calc.ml
> lexer.mll
> tokens.mly
> parser.mly
>
> where tokens.mly are shared by the lexer and parser.
>
> My _tag file is:
> true: use_menhir, debug, profile
> "tokens.mly": only_tokens
> "parser.mly": token_base, ext_tokens, use_tokens
>
> My myocamlbuild file is:
> open Ocamlbuild_plugin;;
> open Command;;
>
> dispatch begin function
> | After_rules ->
>
> (* Menhir --explain flag *)
> flag ["ocaml"; "parser" ; "menhir" ; "use_menhir" ]
> (S[A"--explain"]);
>
> (* Menhir --only-tokens flag *)
> flag ["ocaml"; "parser"; "menhir"; "only_tokens" ] (A"--only-tokens");
> flag ["ocaml"; "menhir_ocamldep"; "only_tokens" ] (A"--only-tokens");
>
> (* Menhir --external-tokens and --base flag *)
> flag ["ocaml"; "parser"; "menhir"; "ext_tokens" ]
> (S[A"--external-tokens";
> A"Tokens";
> A"tokens.mly"; ]);
> flag ["ocaml"; "menhir_ocamldep"; "ext_tokens" ]
> (S[A"--external-tokens";
> A"Tokens";
> A"tokens.mly"; ]);
>
> flag ["ocaml"; "parser"; "menhir"; "token_base" ] (S[A"--base";
> A"parser"; ]);
> flag ["ocaml"; "menhir_ocamldep"; "token_base" ] (S[A"--base";
> A"parser"; ]);
>
> dep ["ocaml"; "menhir_ocamldep"; "use_tokens"] ["fake.ml"];
> dep ["ocaml"; "parser"; "menhir"; "use_tokens"] ["fake.cmi"];
>
> | _ -> ()
> end;;
>
> And I use a target file:
> calc.d.byte
>
> and invoke ocamlbuild using a shell script with:
> ocamlbuild -verbose 100 all.otarget
>
> The build process always ends with:
>
> + /home/hugof/ocaml/godi/bin/ocamlc.opt -c -g -o calc.cmo calc.ml
> File "calc.ml", line 35, characters 2-13:
> Unbound module Parser.Make
> Command exited with code 2.
>
> And no parser dependency file is generated.
> In fact in this case no parser.mly file is even compiled.
>
> I have tried quite a few variations, but none seem to work.
> I addition to this I have noticed that Ocambuild repeats the
> use of flags that may cause errors. In the line below is an example
> where flag "--only-tokens" is repeated 3 times. Is this correct?
>
> # Target: tokens.mly.depends, tags: { debug, extension:mly,
> file:tokens.mly, menhir_ocamldep, ocaml, ocamldep, only_tokens, profile,
> quiet, traverse, use_menhir }
> /home/hugof/ocaml/godi/bin/menhir --only-tokens --raw-depend --ocamldep
> '/home/hugof/ocaml/godi/bin/ocamldep.opt --only-tokens -pp --only-tokens
> -modules' tokens.mly > tokens.mly.depends
>
> Can any kind soul give me a hand with this seemingly trivial exercise?
>
> TIA,
> Hugo Ferreira.
>
>
> [1]
>
http://caml.inria.fr/pub/ml-archives/caml-list/2007/04/d3b9765dd69a010219144200d925ea39.en.html
> [2] http://cristal.inria.fr/~fpottier/menhir/menhir-20071212.tar.gz
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
reply other threads:[~2008-08-09 8:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1218269517.489d514dbef99@webmail.inescporto.pt \
--to=hmf@inescporto.pt \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox