-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[new release] elpi (2.0.0) #26928
Closed
Closed
[new release] elpi (2.0.0) #26928
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CHANGES: Requires Menhir 20211230 and OCaml 4.08 or above. - Compiler: - Change the pipeline completely to make unit relocation unnecessary. Current phases are (roughly): 1. `Ast.program` —[`RecoverStructure`]—> `Ast.Structured.program` 2. `Ast.Structured.program` —[`Scope`,`Quotation`,`Macro`]—> `Scoped.program` (aka `API.Compile.scoped_program`) 3. `Scoped.program` —[`Flatten`]—> `Flat.program` 4. `Flat.program` —[`Check`]—> `CheckedFlat.program` (aka `API.Compile.compilation_unit`) 5. `CheckedFlat.program` —[`Spill`,`ToDbl`]—> `Assembled.program` Steps 4 and 5 operate on a base, that is an `Assembled.program` being extended. `ToDbl` is in charge of allocating constants (numbers) for global names and takes place when the unit is assembled on the base. These constants don't need to be relocated as in the previous backend that would allocate these constants much earlier. - Change compilation units can declare new builtin predicates - Fix macros are hygienic - New type checker written in OCaml. The new type checker is faster, reports error messages with a precise location and performs checking incrementally when the API for separate compilation is used. The new type checker is a bit less permissive since the old one would merged together all types declaration before type checking the entire program, while the new one type checks each unit using the types declared inside the unit or declared in the base it extends, but not the types declared in units that (will) follow it. - Remove the need of `typeabbrv string (ctype "string")` and similar - New type check types and kinds (used to be ignored). - API: - Change quotations generate `Ast.Term.t` and not `RawData.t`. The data type `Ast.Term.t` contains locations (for locating type errors) and has named (bound) variables and type annotations in `Ast.Type.t`. - New `Compile.extend_signature` and `Compile.signature` to extend a program with the signature (the types, not the code) of a unit - New `Ast.Loc.t` carries a opaque payload defined by the host application - Remove `Query`, only `RawQuery` is available (or `Compile.query`) - Parser: - Remove legacy parser - New `% elpi:if version op A.B.C` and `% elpi:endif` lexing directives - New warning for `A => B, C` to be disabled by putting parentheses around `A => B`. - Language: - New infix `==>` standing for application but with "the right precedence™", i.e. `A ==> B, C` means `A => (B, C)`. - New `pred` is allowed in anonymous predicates, eg: `pred map i:list A, i:(pred i:A, o:B), o:list B` declares that the first argument of `map` is a predicate whose first argument is in input and the second in output. Currently the mode checker is still in development, annotations for higher order arguments are ignored. - New attribute `:functional` can be passed to predicates (but not types). For example, `:functional pred map i:list A, i:(:functional pred i:A, o:B), o:list B` declares `map` to be a functional predicate iff its higher order argument is functional. Currently the determinacy checker is still in development, these annotations are ignored. - New `func` keyword standing for `:functional pred`. The declaration above can be shortened to `func map i:list A, i:(func i:A, o:B), o:list B`. - New type annotations on variables quantified by `pi` as in `pi x : term \ ...` - New type casts on terms, as in `f (x : term)` - New attribute `:untyped` to skip the type checking of a rule. - Stdlib: - New `std.list.init N E L` builds a list `L = [E, ..., E]` with length `N` - New `std.list.make N F L` builds the list `L = [F 0, F 1, ..., F (N-1)]` - New `triple` data type with constructor `triple` and projections `triple_1`... - Builtins: - Remove `string_to_term`, `read`, `readterm`, `quote_syntax` - REPL: - Remove `-no-tc`, `-legacy-parser`, `-legacy-parser-available` - New `-document-infix-syntax`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There also seems to be some issues on some 32 bit architectures during the tests. Some call to Array.make
fails:
# File "src/runtime/dune", line 14, characters 12-19:
# 14 | (test (name test_bl) (libraries elpi.runtime) (modules test_bl) (preprocess (pps ppx_deriving.std)))
# ^^^^^^^
# (cd _build/default/src/runtime && ./test_bl.exe)
# Fatal error: exception Invalid_argument("Array.make")
# make: *** [Makefile:85: tests] Error 1
You should look into it. Possibly make your package not available on the offending architectures?
Co-authored-by: Raphaël Proust <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ELPI - Embeddable λProlog Interpreter
CHANGES:
Requires Menhir 20211230 and OCaml 4.08 or above.
Compiler:
Change the pipeline completely to make unit relocation unnecessary. Current
phases are (roughly):
Ast.program
—[RecoverStructure
]—>Ast.Structured.program
Ast.Structured.program
—[Scope
,Quotation
,Macro
]—>Scoped.program
(akaAPI.Compile.scoped_program
)Scoped.program
—[Flatten
]—>Flat.program
Flat.program
—[Check
]—>CheckedFlat.program
(akaAPI.Compile.compilation_unit
)CheckedFlat.program
—[Spill
,ToDbl
]—>Assembled.program
Steps 4 and 5 operate on a base, that is an
Assembled.program
beingextended.
ToDbl
is in charge of allocating constants (numbers) for globalnames and takes place when the unit is assembled on the base. These
constants don't need to be relocated as in the previous backend that
would allocate these constants much earlier.
Change compilation units can declare new builtin predicates
Fix macros are hygienic
New type checker written in OCaml. The new type checker is faster,
reports error messages with a precise location and performs checking
incrementally when the API for separate compilation is used.
The new type checker is a bit less permissive since the old one would
merged together all types declaration before type checking the entire
program, while the new one type checks each unit using the types declared
inside the unit or declared in the base it extends, but not the types
declared in units that (will) follow it.
Remove the need of
typeabbrv string (ctype "string")
and similarNew type check types and kinds (used to be ignored).
API:
Ast.Term.t
and notRawData.t
. The datatype
Ast.Term.t
contains locations (for locating type errors) andhas named (bound) variables and type annotations in
Ast.Type.t
.Compile.extend_signature
andCompile.signature
to extend aprogram with the signature (the types, not the code) of a unit
Ast.Loc.t
carries a opaque payload defined by the host applicationQuery
, onlyRawQuery
is available (orCompile.query
)Parser:
% elpi:if version op A.B.C
and% elpi:endif
lexing directivesA => B, C
to be disabled by putting parenthesesaround
A => B
.Language:
==>
standing for application but with "the right precedence™",i.e.
A ==> B, C
meansA => (B, C)
.pred
is allowed in anonymous predicates, eg:pred map i:list A, i:(pred i:A, o:B), o:list B
declares that the firstargument of
map
is a predicate whose first argument is in input andthe second in output. Currently the mode checker is still in development,
annotations for higher order arguments are ignored.
:functional
can be passed to predicates (but not types).For example,
:functional pred map i:list A, i:(:functional pred i:A, o:B), o:list B
declares
map
to be a functional predicate iff its higher order argument isfunctional. Currently the determinacy checker is still in development, these
annotations are ignored.
func
keyword standing for:functional pred
. The declaration abovecan be shortened to
func map i:list A, i:(func i:A, o:B), o:list B
.pi
as inpi x : term \ ...
f (x : term)
:untyped
to skip the type checking of a rule.Stdlib:
std.list.init N E L
builds a listL = [E, ..., E]
with lengthN
std.list.make N F L
builds the listL = [F 0, F 1, ..., F (N-1)]
triple
data type with constructortriple
and projectionstriple_1
...Builtins:
string_to_term
,read
,readterm
,quote_syntax
REPL:
-no-tc
,-legacy-parser
,-legacy-parser-available
-document-infix-syntax