English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
ocamlbuild, menhir and keeping tokens in a separate file
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-02 (12:48)
From: Joel Reymont <joelr1@g...>
Subject: Re: [Caml-list] Re: ocamlbuild, menhir and keeping tokens in a separate file

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- 
 > 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- 
 > flag ["ocaml"; "menhir_ocamldep"; "ext_tokens" ] (S[A"--external- 

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";
 > flag ["ocaml"; "menhir_ocamldep"; "token_base" ] (S[A"--base";

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  

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