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: | 2007-05-02 (13:28) |
From: | Joel Reymont <joelr1@g...> |
Subject: | Re: [Caml-list] Re: ocamlbuild, menhir and keeping tokens in a separate file |
On May 2, 2007, at 2:08 PM, Nicolas Pouillard wrote: > 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 would I need to put in my _tags file to use the above? I just have this for now: "EasyToken.mly": only_tokens "EasyParser.mly": token_base, ext_tokens >> Error: EasyToken.mly: No such file or directory >> > From here I don't know why it fails... It fails because EasyToken.mly has not been copied to _build. How do I force a copy? For now I have to use "../EasyToken.mly" below flag ["ocaml"; "parser"; "menhir"; "ext_tokens" ] (S[A"--external- tokens"; A"EasyToken"; A"../ EasyToken.mly"; ]); Still, there's something wrong with dependencies ocamlbuild Test.byte + /usr/local/bin/menhir --ocamlc 'ocamlfind ocamlc -package ounit' -- explain --external-tokens EasyToken ../EasyToken.mly --base EasyParser --infer EasyParser.mly File "EasyParser.mly", line 54, characters 27-44: Unbound type constructor EasySymtab.symbol The problem is that EasySymtab has not been compiled yet. _build/ EasyParser.mly.depends is size 0 which is wrong since EasyParser.mly opens a bunch of modules. I tried this a couple of times from scratch and it's always size 0. The tail of the log file below shows that ocamlbuild runs dependencies on EasyLexer but proceeds to compile EasyParser without figuring out its dependencies. # Target: EasyLexer.mll, tags: { extension:mll, file:EasyLexer.mll, lexer, ocaml, ocamllex, quiet, traverse, use_menhir } /usr/local/bin/ocamllex.opt -q EasyLexer.mll # cached # Target: EasyLexer.ml.depends, tags: { extension:ml, file:EasyLexer.ml, ocaml, ocamldep, quiet, traverse, use_menhir } /usr/local/bin/ocamldep.opt -modules EasyLexer.ml > EasyLexer.ml.depends # cached # Target: EasyParser.mly, tags: { ext_tokens, extension:mly, file:EasyParser.mly, menhir, ocaml, parser, quiet, token_base, traverse, use_menhir } /usr/local/bin/menhir --ocamlc 'ocamlfind ocamlc -package ounit' -- explain --external-tokens EasyToken ../EasyToken.mly --base EasyParser --infer EasyParser.mly -- http://wagerlabs.com/