Commit Graph

26 Commits (9e181ca8f446d238ba279bc22fef9d166d4f38b0)

Author SHA1 Message Date
Sébastien Hinderer 87d475c5e0 Makefile.menhir enhancement
This commit factorizes the way the menhir flags for unused tokens
is defined. It also brings the comments explaining why tokens are
unused above the definition of the unused_tokens variable.
2019-01-10 12:22:23 +01:00
Gabriel Scherer 46ef054330 Makefiles: restructure CAMLDEP usage to easily add flags
This change should be a refactoring no-op.

Before, a DEPFLAGS variable existed in some makefiles to contain
include directories to be passed to ocamldep invocations, but no
support for easily adding command-line flags to ocamldep was available
(invocations would systematically use -slash, which was duplicated
across callsites).

With this PR, a new DEPINCLUDES variable contains the include
directories, and DEPFLAGS is repurposed to contain other command-line
flags for the tool -- currently "slash".
2018-12-12 09:30:55 +01:00
François Pottier 86a14713db Reduce the verbosity of `make promote-menhir`. 2018-11-20 12:44:39 +01:00
François Pottier a4419a8f87 New entry `make interpret-menhir`, to help understand and debug the parser. 2018-11-20 12:28:18 +01:00
François Pottier fe0b3f3dfb In `Makefile.menhir`, request the production of `parser.automaton`. 2018-11-20 12:28:18 +01:00
François Pottier de3dcf1e2e Create [make demote-menhir] to undo the effect of [make promote-menhir]. 2018-11-20 11:52:47 +01:00
Gabriel Scherer 5aa6713a57 [minor] Makefile.menhir
This fixes a problematic issue to a wrong Makefile.menhir that
was supposed to have been fixed by f10736b9e6, but actually was not.

Apologies for the flawed commits and for the noise.

(This is the sort of horror sorry when the `mv`, which intended to move
temporary Menhir-produced files to `boot/`, was wrongly placed (by myself)
on the call to copy the runtime files from Menhir's installation directory
into `boot/`. As a result, running 'promote-menhir' would break your Menhir
install...)
2018-09-07 23:06:10 +02:00
Gabriel Scherer 596b2b4869 [minor] Makefile.menhir bugfix for non-subsecond make systems
François Pottier reported that, on his mac machine,
"make promote-menhir; make world" fails: it seemed
that parsing/parser.ml, after being produced as a temporary
file by the promote-menhir target, is not refreshed using
the `parsing/parser.ml: boot/menhir/parser.ml` rule from
Makefile (which does the MenhirLib->CamlinternalMenhirlib renaming).

The issue comes down to the fact that while boot/menhir/parser.ml
is always younger than the parsing/parser.ml produced by promote,
the time difference is very small (parser.ml is copied in boot/
immediately after production), and macos doesn't record creation times
with enough precision to notice it.

This PR removes the temporary parsing/parser.ml created by Menhir
in the promote-menhir rule, so that this file is not seen anymore
by 'make world', and has to be properly reproduced from boot/.
2018-09-07 13:33:42 +02:00
Gabriel Scherer f10736b9e6 Revert "[minor] Makefile.menhir bugfix for non-subsecond make systems"
This reverts commit ae03c67cba.
2018-09-07 13:33:32 +02:00
Gabriel Scherer ae03c67cba [minor] Makefile.menhir bugfix for non-subsecond make systems
François Pottier reported that, on his mac machine,
"make promote-menhir; make world" fails: it seemed
that parsing/parser.ml, after being produced as a temporary
file by the promote-menhir target, is not refreshed using
the `parsing/parser.ml: boot/menhir/parser.ml` rule from
Makefile (which does the MenhirLib->CamlinternalMenhirlib renaming).

The issue comes down to the fact that while boot/menhir/parser.ml
is always younger than the parsing/parser.ml produced by promote,
the time difference is very small (parser.ml is copied in boot/
immediately after production), and macos doesn't record creation times
with enough precision to notice it.

This PR removes the temporary parsing/parser.ml created by Menhir
in the promote-menhir rule, so that this file is not seen anymore
by 'make world', and has to be properly reproduced from boot/.
2018-09-07 13:33:28 +02:00
Gabriel Scherer 0703c1b477 [minor] Makefile.menhir bugfix for non-subsecond make systems
François Pottier reported that, on his mac machine,
"make promote-menhir; make world" fails: it seemed
that parsing/parser.ml, after being produced as a temporary
file by the promote-menhir target, is not refreshed using
the `parsing/parser.ml: boot/menhir/parser.ml` rule from
Makefile (which does the MenhirLib->CamlinternalMenhirlib renaming).

The issue comes down to the fact that while boot/menhir/parser.ml
is always younger than the parsing/parser.ml produced by promote,
the time difference is very small (parser.ml is copied in boot/
immediately after production), and macos doesn't record creation times
with enough precision to notice it.

This PR removes the temporary parsing/parser.ml created by Menhir
in the promote-menhir rule, so that this file is not seen anymore
by 'make world', and has to be properly reproduced from boot/.
2018-09-07 13:27:08 +02:00
Gabriel Scherer f359bf527d Makefile.menhir: sanitize the standard.mly path to avoid useless churn
Tested by François Pottier.
2018-09-06 19:06:09 +02:00
François Pottier aa89a50818 Fix a typo. 2018-09-06 11:51:06 +02:00
François Pottier d563e2e75e In [make test-menhir], use a sed invocation that works both on MacOS and Linux. 2018-09-06 11:50:34 +02:00
François Pottier 6d23e94222 Make menhir a bit more verbose by passing -lg 1 -la 1.
This helps see at a glance how the automaton is affected by a change.
2018-09-06 11:50:34 +02:00
Gabriel Scherer 51912516fa [minor] documentation improvements for Makefile.menhir 2018-09-06 11:10:48 +02:00
Gabriel Scherer 80db356e9c add a .depend.menhir file for menhir parser dependencies
We do not write to .depend during the common 'depend' target,
because computing dependencies requires Menhir installed.
2018-09-01 23:17:06 +02:00
Gabriel Scherer d09349f631 rename parsing/parser_menhir into parsing/parser 2018-09-01 23:17:06 +02:00
Gabriel Scherer e6ecea4008 remove the yacc parser
The large diff in boot/menhir/parser_menhir.ml comes from the fact
that the token list is now included in it, instead of being merely
a reference to the yacc parsers' Parser.token type.
2018-09-01 23:17:06 +02:00
Gabriel Scherer 982ac40b5a menhir --fixed-exception, use the same exception as yacc 2018-09-01 23:17:05 +02:00
Gabriel Scherer f571282d7d menhir parser: rename MenhirLib into CamlinternalMenhirLib
The goal of this change is to avoid conflicts encountered by
compiler-libs users that would also use their own MenhirLib runtime
for their own parsers.

I first tried to implement a solution to this module-name-conflict
issue using module aliases and -open, but this proven too fragile and
too difficult to get right.
2018-09-01 23:17:04 +02:00
Gabriel Scherer 5fb52b21ea menhir parser: use --lalr mode on François Pottier's advice 2018-09-01 23:17:04 +02:00
Gabriel Scherer 5794656607 Makefile.menhir: enable strict mode
The yacc parser already uses its --strict flag, which turns grammar
conflicts into build errors so that they are noticed. Menhir uses
a more extensive semantics for the --strict flag, as it turns into
errors grammar warnings that have no yacc counterpart, in particular
unused precedence levels. We have to fix more mistakes, which I guess
is good news.
2018-09-01 23:17:04 +02:00
Gabriel Scherer db15ee7793 Makefile.menhir: some tokens are unused for decent reasons 2018-09-01 23:17:04 +02:00
Gabriel Scherer cbea1b6b69 menhir parser: move .mlyp to .mly, no cpp step anymore 2018-09-01 23:17:04 +02:00
Gabriel Scherer 4aa3b8c788 new Makefile.menhir file for menhir parser bootstrap 2018-09-01 23:17:03 +02:00