Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: "Joel Reymont" <joelr1@gmail.com>
Cc: "Caml List" <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: ocamlbuild, menhir and keeping tokens in a separate file
Date: Wed, 2 May 2007 15:08:56 +0200	[thread overview]
Message-ID: <cd67f63a0705020608n392a6036ybc2e04d4166f09c6@mail.gmail.com> (raw)
In-Reply-To: <4652F73F-9CAA-4C47-AA11-0D5CFDCAE79B@gmail.com>

On 5/2/07, Joel Reymont <joelr1@gmail.com> wrote:
> Nicolas,
>
> Thank you very much for your help and answers. I'm slowly learning!
>
> I have the following in my plugin now...
>
>  > flag ["ocaml"; "parser"; "menhir" ] (A"--explain");
>
> I always want to run Menhir with --explain in the parsing phase.
>

Ok

>  > flag ["ocaml"; "parser"; "menhir"; "only_tokens" ] (A"--only-
> tokens");
>  > flag ["ocaml"; "menhir_ocamldep"; "only_tokens" ] (A"--only-tokens");
>
> I wish the tail portion could be combined, i.e. "only_tokens" ] (A"--
> only-tokens"); created once and then appended somehow. Just a minor
> wish, though, although comments are always appreciated.

That kind of factorisation is not yet available.

>  > flag ["ocaml"; "parser"; "menhir"; "ext_tokens" ] (S[A"--external-
> tokens";
>                                                         A"EasyToken";
>
> A"EasyToken.mly";
>                                                        ]);
>  > flag ["ocaml"; "menhir_ocamldep"; "ext_tokens" ] (S[A"--external-
> tokens";
>                                                      A"EasyToken";
>                                                      A"EasyToken.mly";
>                                                     ]);
>
> Is there a way to create a "hole" for A"EasyToken" that can be filled
> from the _tags file?
>
> I may have different parsers in the project and not all of then would
> use EasyToken as the external token module.

No but you can have some rules for each parser.

You can generate these rules:

let mk_ext_token parser token =
  flag ["ocaml"; "menhir_ocamldep"; "file:"^parser^".mly"]
    (S[A"--external-tokens"; A token; A(token^".mly")]);
  flag ["ocaml"; "parser"; "menhir"; "file:"^parser^".mly"]
    (S[A"--base"; A parser]);
  ....

[...]

> What happens when I run ocamlbuild?
>
> ocamlbuild Test.byte
> + /usr/local/bin/menhir --external-tokens EasyToken EasyToken.mly --
> base EasyParser --raw-depend --ocamldep '/usr/local/bin/ocamldep.opt -
> modules' EasyParser.mly > EasyParser.mly.depends
> Error: EasyToken.mly: No such file or directory
>
> Why are the external tokens and base options used above???
>
> And why is EasyToken.mly not found?
>
> What did I get wrong in my plugin and tags file?

>From here I don't know why it fails...

-- 
Nicolas Pouillard


  reply	other threads:[~2007-05-02 13:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27 23:38 Joel Reymont
2007-04-27 23:50 ` Joel Reymont
2007-04-28  0:05   ` Joel Reymont
2007-04-28  0:34     ` Joel Reymont
2007-04-28 15:14       ` [Caml-list] " Nicolas Pouillard
2007-04-28 15:12     ` Nicolas Pouillard
2007-05-02  8:51       ` Joel Reymont
2007-05-02 11:54         ` Nicolas Pouillard
2007-05-02 12:00           ` Joel Reymont
2007-05-02 12:48           ` Joel Reymont
2007-05-02 13:08             ` Nicolas Pouillard [this message]
2007-05-02 13:28               ` Joel Reymont
2007-05-02 13:47               ` Joel Reymont
2007-05-02 14:55               ` Joel Reymont
2007-05-03  7:26                 ` Nicolas Pouillard

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=cd67f63a0705020608n392a6036ybc2e04d4166f09c6@mail.gmail.com \
    --to=nicolas.pouillard@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.com \
    /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