Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
f4390675
Commit
f4390675
authored
Dec 18, 2014
by
POTTIER Francois
Browse files
Removed my recent big comment on --depend, which was mostly wrong.
parent
4b46e509
Changes
3
Hide whitespace changes
Inline
Side-by-side
TODO
View file @
f4390675
* understand whether/why --depend needs a mock [.mli] file too
* Confirm and understand why the code back-end slows down by 50%
* Confirm and understand why the code back-end slows down by 50%
between 4.01.0 and 4.02.1. Use the tag last309 for this purpose,
between 4.01.0 and 4.02.1. Use the tag last309 for this purpose,
or the master branch.
or the master branch.
...
...
src/front.ml
View file @
f4390675
...
@@ -80,8 +80,8 @@ let () =
...
@@ -80,8 +80,8 @@ let () =
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* If [--depend] was specified on the command line,
perform dependency
(* If [--depend]
or [--raw-depend]
was specified on the command line,
analysis and stop. *)
perform dependency
analysis and stop. *)
let
()
=
let
()
=
match
Settings
.
depend
with
match
Settings
.
depend
with
...
@@ -91,37 +91,12 @@ let () =
...
@@ -91,37 +91,12 @@ let () =
|
Settings
.
OMNone
->
|
Settings
.
OMNone
->
()
()
(* [--depend] is really a strange hack: we are expected to be able to predict
(* The purpose of [--depend] and [--raw-depend] is to support [--infer].
the dependencies exhibited by the [.ml] and [.mli] files produced by
Indeed, [--infer] is implemented by producing a mock [.ml] file (which
Menhir, *without* actually producing these files, because we cannot yet
contains just the semantic actions) and invoking [ocamlc]. This requires
produce them. (If [--infer] is enabled, producing these files would require
certain [.cmi] files to exist. So, [--depend] is a way for us to announce
consulting certain [.cmi] files that may not exist yet.) *)
which [.cmi] files we need. It is implemented by producing the mock [.ml]
file and running [ocamldep] on it. *)
(* Remarks. 1- If [make] was not brain-dead, we would not have to do this in
the first place. A good compilation manager should be able to mix the
production of targets and the dependency analysis. Apparently, by this
definition, [ocamlbuild] is brain-dead too: it uses [menhir --raw-depend].
2- We are able to do this because we can produce mock [.ml] and [.mli]
files that exhibit the same dependencies as the real ones. This allows us
to run [ocamldep] on these mock files and obtain correct depdendency
information. Traditionally, our mock [.mli] file was in fact the final
[.mli] file, and our mock [.ml] file contained just the semantic actions
and nothing else. (But see 4- below.)
3- If both [--depend] and [--infer] are enabled, we must effectively ignore
[--infer] and perform the dependency computation without attempting to
perform type inference. Indeed, as mentioned above, that would require
consulting certain [.cmi] files that may not exist yet.
4- As of 2014/12/17, we would like to produce as part of the [.mli] file
a type [nonterminal] which lists all nonterminal symbols together with
their OCaml type. This typically requires [--infer]. Thus, this implies
that the mock [.mli] file can no longer be the same as the final [.mli]
file; the mock cannot contain the type [nonterminal]. As a result, maybe
the dependencies (computed based on the mock) will be incomplete. Which
would be a problem (failure to build). I am not sure at the moment how
to address this problem. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
...
...
src/infer.ml
View file @
f4390675
...
@@ -242,11 +242,10 @@ let depend grammar =
...
@@ -242,11 +242,10 @@ let depend grammar =
print_string
output
;
print_string
output
;
(* If [--raw-depend] was specified on the command line, stop here.
(* If [--raw-depend] was specified on the command line, stop here. This
This option is used by omake, which performs its own
option is used by omake and by ocamlbuild, which performs their own
postprocessing of [ocamldep]'s output. For normal [make] users,
postprocessing of [ocamldep]'s output. For normal [make] users, who use
who use [--depend], some postprocessing is required, which is
[--depend], some postprocessing is required, which is performed below. *)
performed below. *)
begin
match
Settings
.
depend
with
begin
match
Settings
.
depend
with
|
Settings
.
OMNone
->
|
Settings
.
OMNone
->
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment