2020-01-10 18:32:54 +04:00
|
|
|
;; Build of the lexer
|
|
|
|
|
2019-09-27 17:33:25 +04:00
|
|
|
(ocamllex LexToken)
|
2019-05-12 21:31:22 +04:00
|
|
|
|
2020-01-10 18:32:54 +04:00
|
|
|
;; Build of the parser
|
|
|
|
|
2019-05-12 21:31:22 +04:00
|
|
|
(menhir
|
2020-01-03 19:58:37 +04:00
|
|
|
(merge_into Parser)
|
|
|
|
(modules ParToken Parser)
|
|
|
|
(flags -la 1 --table --strict --explain --external-tokens LexToken))
|
2019-05-12 21:31:22 +04:00
|
|
|
|
2020-01-10 18:32:54 +04:00
|
|
|
;; Build of the parser as a library
|
|
|
|
|
2019-05-12 21:31:22 +04:00
|
|
|
(library
|
2020-01-03 19:58:37 +04:00
|
|
|
(name parser_cameligo)
|
|
|
|
(public_name ligo.parser.cameligo)
|
2020-01-14 04:27:35 +04:00
|
|
|
(modules
|
2020-01-23 21:28:04 +04:00
|
|
|
Scoping AST cameligo Parser ParserLog LexToken ParErr)
|
2020-01-03 19:58:37 +04:00
|
|
|
(libraries
|
|
|
|
menhirLib
|
|
|
|
parser_shared
|
|
|
|
str
|
|
|
|
simple-utils
|
2020-01-23 21:28:04 +04:00
|
|
|
tezos-utils)
|
2020-01-03 19:58:37 +04:00
|
|
|
(preprocess
|
2020-01-04 22:49:22 +04:00
|
|
|
(pps bisect_ppx --conditional))
|
2020-01-23 21:28:04 +04:00
|
|
|
(flags (:standard -open Parser_shared -open Simple_utils)))
|
2019-05-12 21:31:22 +04:00
|
|
|
|
2020-01-10 18:32:54 +04:00
|
|
|
;; 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
|
|
|
|
|
2019-09-27 17:33:25 +04:00
|
|
|
(executable
|
|
|
|
(name LexerMain)
|
2019-12-26 16:23:32 +04:00
|
|
|
(libraries parser_cameligo)
|
|
|
|
(modules LexerMain)
|
2019-12-11 22:07:52 +04:00
|
|
|
(preprocess
|
|
|
|
(pps bisect_ppx --conditional))
|
2019-12-17 20:03:43 +04:00
|
|
|
(flags (:standard -open Parser_shared -open Parser_cameligo)))
|
2019-05-12 21:31:22 +04:00
|
|
|
|
2020-01-10 18:32:54 +04:00
|
|
|
;; Local build of a standalone parser
|
|
|
|
|
2019-09-27 17:33:25 +04:00
|
|
|
(executable
|
|
|
|
(name ParserMain)
|
2019-12-26 16:23:32 +04:00
|
|
|
(libraries parser_cameligo)
|
2020-01-23 21:28:04 +04:00
|
|
|
(modules ParserMain)
|
2019-12-11 22:07:52 +04:00
|
|
|
(preprocess
|
|
|
|
(pps bisect_ppx --conditional))
|
2019-12-17 20:03:43 +04:00
|
|
|
(flags (:standard -open Simple_utils -open Parser_shared -open Parser_cameligo)))
|
2019-12-26 16:23:32 +04:00
|
|
|
|
2020-01-10 18:32:54 +04:00
|
|
|
;; Build of the covering of error states in the LR automaton
|
2020-01-09 19:41:21 +04:00
|
|
|
|
|
|
|
(rule
|
|
|
|
(targets Parser.msg)
|
|
|
|
(deps (:script_messages ../../../../vendors/ligo-utils/simple-utils/messages.sh) Parser.mly LexToken.mli ParToken.mly)
|
2020-01-10 18:32:54 +04:00
|
|
|
(action (run %{script_messages} --lex-tokens=LexToken.mli --par-tokens=ParToken.mly Parser.mly)))
|
|
|
|
|
|
|
|
;; Build of all the LIGO source file that cover all error states
|
2020-01-09 19:41:21 +04:00
|
|
|
|
|
|
|
(rule
|
2020-01-14 04:27:35 +04:00
|
|
|
(targets all.mligo)
|
2020-01-09 19:41:21 +04:00
|
|
|
(deps (:script_cover ../../../../vendors/ligo-utils/simple-utils/cover.sh) Parser.mly LexToken.mli ParToken.mly Parser.msg Unlexer.exe)
|
2020-01-23 21:28:04 +04:00
|
|
|
(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 19:05:59 +04:00
|
|
|
|
|
|
|
;; Error messages
|
|
|
|
|
|
|
|
;; Generate error messages from scratch
|
|
|
|
; (rule
|
|
|
|
; (targets error.messages)
|
|
|
|
; (deps Parser.mly ParToken.mly error.messages.checked-in)
|
|
|
|
; (action
|
|
|
|
; (with-stdout-to %{targets}
|
|
|
|
; (bash
|
|
|
|
; "menhir \
|
|
|
|
; --unused-tokens \
|
|
|
|
; --list-errors \
|
|
|
|
; --table \
|
|
|
|
; --strict \
|
|
|
|
; --external-tokens LexToken.mli \
|
|
|
|
; --base Parser.mly \
|
|
|
|
; ParToken.mly \
|
|
|
|
; Parser.mly
|
|
|
|
; "
|
|
|
|
; )
|
|
|
|
; ))
|
|
|
|
; )
|
|
|
|
|
|
|
|
(rule
|
|
|
|
(targets error.messages)
|
|
|
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
|
|
|
(action
|
|
|
|
(with-stdout-to %{targets}
|
|
|
|
(run
|
|
|
|
menhir
|
|
|
|
--unused-tokens
|
|
|
|
--update-errors error.messages.checked-in
|
|
|
|
--table
|
|
|
|
--strict
|
|
|
|
--external-tokens LexToken.mli
|
|
|
|
--base Parser.mly
|
|
|
|
ParToken.mly
|
|
|
|
Parser.mly
|
|
|
|
)
|
|
|
|
))
|
|
|
|
)
|
|
|
|
|
|
|
|
(rule
|
|
|
|
(target error.messages.new)
|
|
|
|
(action
|
|
|
|
(with-stdout-to %{target}
|
|
|
|
(run
|
|
|
|
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
|
|
|
|
(run
|
|
|
|
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)
|
|
|
|
(deps Parser.mly ParToken.mly error.messages.checked-in LexToken.mli)
|
|
|
|
(action
|
|
|
|
(with-stdout-to %{targets}
|
|
|
|
(run
|
|
|
|
menhir
|
|
|
|
--unused-tokens
|
|
|
|
--table
|
|
|
|
--strict
|
|
|
|
--external-tokens LexToken.mli
|
|
|
|
--base Parser.mly
|
|
|
|
ParToken.mly
|
|
|
|
Parser.mly
|
|
|
|
--compile-errors error.messages.checked-in
|
|
|
|
)
|
|
|
|
))
|
|
|
|
)
|