Browse thread
ocamlbuild, menhir and keeping tokens in a separate file
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Joel Reymont <joelr1@g...> |
| Subject: | Re: [Caml-list] Re: ocamlbuild, menhir and keeping tokens in a separate file |
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.
> 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.
> 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.
> flag ["ocaml"; "parser"; "menhir"; "token_base" ] (S[A"--base";
A"EasyParser";
]);
> flag ["ocaml"; "menhir_ocamldep"; "token_base" ] (S[A"--base";
A"EasyParser";
]);
Another tag for Menhir.
> dep ["ocaml"; "menhir_ocamldep"; "use_tokens"] ["EasyToken.mly"];
> dep ["ocaml"; "parser"; "menhir"; "use_tokens"] ["EasyToken.mly"];
The token file needs to be generated before the parser. Can a hole be
created here to be filled from _tags? My token file won't always be
EasyToken.mly.
Now in the _tags file I have...
> true: use_menhir
I want to always use Menhir.
> "EasyParser.mly": token_base, use_tokens, ext_tokens
I thought what I'm telling ocamlbuild is that to generate EasyParser
it needs to pass Menhir the --base ... and ext_tokens flags, and that
EasyParser.mly depends on EasyToken.mly.
I may have gotten the dependency wrong since EasyToken.mly is not a
generated file, it just needs to be processed before. In fact, I may
not even need the dependency since I'm force-feeding Menhir the file
on the command line.
> "EasyToken.mly": only_tokens
I want to compile the above with _just_ the --only-tokens option.
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?
Thanks, Joel
--
http://wagerlabs.com/