172 lines
3.8 KiB
Plaintext
Raw Normal View History

;; Build of the lexer
(ocamllex LexToken)
;; Build of the parser
(menhir
(merge_into Parser)
(modules ParToken Parser)
(flags -la 1 --table --strict --explain --external-tokens LexToken))
;; Build of the parser as a library
(library
(name parser_cameligo)
(public_name ligo.parser.cameligo)
(modules
2020-06-12 12:58:38 +02:00
Scoping cameligo Parser LexToken ParErr Pretty)
(libraries
pprint
terminal_size
menhirLib
parser_shared
str
simple-utils
2020-06-12 12:58:38 +02:00
tezos-utils
cst
)
(preprocess
(pps bisect_ppx --conditional))
(flags (:standard -open Parser_shared -open Simple_utils)))
;; Build of the unlexer (for covering the error states of the LR
;; automaton)
(executable
(name Unlexer)
(libraries str)
(preprocess
(pps bisect_ppx --conditional))
(modules Unlexer))
;; Local build of a standalone lexer
(executable
(name LexerMain)
(libraries parser_cameligo)
(modules LexerMain)
2019-12-11 19:07:52 +01:00
(preprocess
(pps bisect_ppx --conditional))
(flags (:standard -open Parser_shared -open Parser_cameligo)))
;; Local build of a standalone parser
(executable
(name ParserMain)
(libraries parser_cameligo)
(modules ParserMain Parser_msg)
2019-12-11 19:07:52 +01:00
(preprocess
(pps bisect_ppx --conditional))
(flags (:standard -open Simple_utils -open Parser_shared -open Parser_cameligo)))
;; Build of the covering of error states in the LR automaton
2020-01-09 16:41:21 +01:00
(rule
(targets Parser.msg)
(deps (:script_messages ../../../../vendors/ligo-utils/simple-utils/messages.sh) Parser.mly LexToken.mli ParToken.mly)
(action (run %{script_messages} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly Parser.mly)))
(rule
(targets Parser_msg.ml)
(deps Parser.mly ParToken.mly Parser.msg)
(action
(with-stdout-to %{targets}
(bash
"menhir \
--compile-errors Parser.msg \
--external-tokens LexToken \
--base Parser \
ParToken.mly \
Parser.mly"))))
;; Build of all the LIGO source file that cover all error states
2020-01-09 16:41:21 +01:00
(rule
(targets all.mligo)
2020-01-09 16:41:21 +01:00
(deps (:script_cover ../../../../vendors/ligo-utils/simple-utils/cover.sh) Parser.mly LexToken.mli ParToken.mly Parser.msg Unlexer.exe)
(action (run %{script_cover} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly --ext=mligo --unlexer=./Unlexer.exe --messages=Parser.msg --dir=. --concatenate Parser.mly )))
2020-01-31 16:05:59 +01:00
;; Error messages
(rule
(targets error.messages)
2020-04-22 12:04:21 -05:00
(mode (promote (until-clean) (only *)))
2020-01-31 16:05:59 +01:00
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
(action
2020-04-13 16:31:56 +02:00
(with-stdout-to %{targets}
(run
2020-01-31 16:05:59 +01:00
menhir
--unused-tokens
2020-04-13 16:31:56 +02:00
--update-errors error.messages.checked-in
2020-01-31 16:05:59 +01:00
--table
--strict
--external-tokens LexToken.mli
--base Parser.mly
ParToken.mly
Parser.mly
)
))
)
(rule
(target error.messages.new)
2020-04-22 12:04:21 -05:00
(mode (promote (until-clean) (only *)))
2020-01-31 16:05:59 +01:00
(action
2020-04-13 16:31:56 +02:00
(with-stdout-to %{target}
(run
2020-01-31 16:05:59 +01:00
menhir
--unused-tokens
--list-errors
--table
--strict
--external-tokens LexToken.mli
--base Parser.mly
ParToken.mly
Parser.mly
)
)
)
)
(alias
(name runtest)
(deps error.messages error.messages.new)
(action
2020-04-13 16:31:56 +02:00
(run
2020-01-31 16:05:59 +01:00
menhir
--unused-tokens
--table
--strict
--external-tokens LexToken.mli
--base Parser.mly
ParToken.mly
Parser.mly
--compare-errors error.messages.new
--compare-errors error.messages
)
)
)
(rule
(targets ParErr.ml)
2020-04-22 12:04:21 -05:00
(mode (promote (until-clean) (only *)))
2020-01-31 16:05:59 +01:00
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
(action
2020-04-13 16:31:56 +02:00
(with-stdout-to %{targets}
(run
2020-01-31 16:05:59 +01:00
menhir
--unused-tokens
--table
--strict
--external-tokens LexToken.mli
--base Parser.mly
ParToken.mly
Parser.mly
--compile-errors error.messages.checked-in
)
))
)