mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
a415355a39
The phantom polymorphic variant qualifying AST nodes is reversed: - previously, we were explicitely restricting each AST node to the passes where it belonged using a closed type (e.g. `[< dcalc | lcalc]`) - now, each node instead declares the "feature" it provides using an open type (e.g. `[> 'Exceptions ]`) - then the AST for a specific pass limits the features it allows with a closed type The result is that you can mix and match all features if you wish, even if the result is not a valid AST for any given pass. More interestingly, it's now easier to write a function that works on different ASTs at once (it's the inferred default if you don't write a type restriction). The opportunity was also taken to simplify the encoding of the operators, which don't need a second type parameter anymore.
95 lines
1.5 KiB
Plaintext
95 lines
1.5 KiB
Plaintext
(library
|
|
(name surface)
|
|
(public_name catala.surface)
|
|
(libraries
|
|
catala_utils
|
|
menhirLib
|
|
sedlex
|
|
re
|
|
zarith
|
|
zarith_stubs_js
|
|
dates_calc
|
|
shared_ast)
|
|
(preprocess
|
|
(pps sedlex.ppx visitors.ppx)))
|
|
|
|
(rule
|
|
(with-stdout-to
|
|
lexer_en.ml
|
|
(run %{bin:cppo} %{dep:lexer_en.cppo.ml} %{dep:lexer.cppo.ml})))
|
|
|
|
(rule
|
|
(with-stdout-to
|
|
lexer_fr.ml
|
|
(run %{bin:cppo} %{dep:lexer_fr.cppo.ml} %{dep:lexer.cppo.ml})))
|
|
|
|
(rule
|
|
(with-stdout-to
|
|
lexer_pl.ml
|
|
(run %{bin:cppo} %{dep:lexer_pl.cppo.ml} %{dep:lexer.cppo.ml})))
|
|
|
|
(menhir
|
|
(modules tokens)
|
|
(flags --only-tokens))
|
|
|
|
(menhir
|
|
(modules tokens parser)
|
|
(merge_into parser)
|
|
(flags --external-tokens Tokens --table --explain))
|
|
|
|
(rule
|
|
(target grammar.html)
|
|
(action
|
|
(run obelisk html -i -o %{target} %{dep:parser.mly})))
|
|
|
|
(documentation
|
|
(package catala)
|
|
(mld_files surface))
|
|
|
|
;; No built-in support for Menhir's parser messages yet
|
|
|
|
(rule
|
|
(with-stdout-to
|
|
parser.messages.new
|
|
(run
|
|
menhir
|
|
%{dep:tokens.mly}
|
|
%{dep:parser.mly}
|
|
--base
|
|
parser
|
|
--list-errors)))
|
|
|
|
(rule
|
|
(with-stdout-to
|
|
parser_errors.ml
|
|
(run
|
|
menhir
|
|
%{dep:tokens.mly}
|
|
%{dep:parser.mly}
|
|
--base
|
|
parser
|
|
--compile-errors
|
|
%{dep:parser.messages})))
|
|
|
|
(rule
|
|
(with-stdout-to
|
|
parser.messages.updated
|
|
(run
|
|
menhir
|
|
%{dep:tokens.mly}
|
|
%{dep:parser.mly}
|
|
--base
|
|
parser
|
|
--update-errors
|
|
%{dep:parser.messages})))
|
|
|
|
(rule
|
|
(alias update-parser-messages)
|
|
(action
|
|
(diff parser.messages parser.messages.updated)))
|
|
|
|
(rule
|
|
(alias create-parser-messages)
|
|
(action
|
|
(diff parser.messages parser.messages.new)))
|