1
|
(menhir
|
2
|
(modules parser_lustre)
|
3
|
(flags --explain))
|
4
|
|
5
|
;; The use of [--external-tokens Parser] is required for the two parsers
|
6
|
;; to share a single [token] type. This makes them usable with the same
|
7
|
;; lexer.
|
8
|
|
9
|
(menhir
|
10
|
(modules parser_lustre)
|
11
|
(merge_into parser_lustre_table)
|
12
|
(flags --table --external-tokens Parser_lustre))
|
13
|
|
14
|
(ocamllex lexerLustreSpec lexer_lustre)
|
15
|
|
16
|
;; -----------------------------------------------------------------------------
|
17
|
|
18
|
;; This section deals with the .messages file.
|
19
|
|
20
|
;; The following rule generates "parser_lustre_messages.ml" based on the source file
|
21
|
;; "parser_lustre.messages". It requires the completeness check to have been
|
22
|
;; performed first. (If desired, this check could be disabled.)
|
23
|
|
24
|
(rule
|
25
|
(deps parser_lustre.check)
|
26
|
(action
|
27
|
(with-stdout-to
|
28
|
parser_lustre_messages.ml
|
29
|
(run
|
30
|
menhir
|
31
|
%{dep:parser_lustre.mly}
|
32
|
--compile-errors
|
33
|
%{dep:parser_lustre.messages}))))
|
34
|
|
35
|
;; This rule generates a file "parser_lustre.auto.messages" that contains a
|
36
|
;; list of all error states. It is used by the completeness check.
|
37
|
|
38
|
(rule
|
39
|
(with-stdout-to
|
40
|
parser_lustre.auto.messages
|
41
|
(run menhir %{dep:parser_lustre.mly} --list-errors)))
|
42
|
|
43
|
;; This rule implements the completeness check. It checks that every error
|
44
|
;; state listed in the auto-generated file "parserMessages.auto.messages"
|
45
|
;; is also listed in the file "parserMessages.messages" that is maintained
|
46
|
;; by the programmer.
|
47
|
|
48
|
(rule
|
49
|
(with-stdout-to
|
50
|
parser_lustre.check
|
51
|
(run
|
52
|
menhir
|
53
|
%{dep:parser_lustre.mly}
|
54
|
--compare-errors
|
55
|
%{dep:parser_lustre.auto.messages}
|
56
|
--compare-errors
|
57
|
%{dep:parser_lustre.messages})))
|