Releases: LPCIC/elpi
3.0.1
3.0.0
CHANGES:
Requires Menhir 20211230 and OCaml 4.13 or above.
-
Language:
- A functional predicate is a predicate that does not leave choice points
for any of its calls. A functional predicate can have preconditions, eg
map
is functional if the higher order argument also is. Functional
predicates (with preconditions) can be miscalled, in that case they behave
as relations. - The matching operator used for input arguments is now also available as a
builtin predicate namedpattern_match
.
- A functional predicate is a predicate that does not leave choice points
-
API:
- New
Utils.ground_check
andUtils.cmp_term
(already available as builtins) - Change
Constants.declare_global_symbol
takes an optionalvariant
argument.
- New
-
Parser:
- The
fprop
keyword is akin toprop
but signals the predicate is functional - The
:functional
attribute flagspred
icates as functional (equivalent tofunc ...
). - Dedicated syntax for functional signatures:
func name(comma_sep(types_of_inputs)* [-> comma_sep(types_of_outputs*)]
.
Example: The signature ofmap
isfunc map list A, (func A -> B) -> list B
- New
[external] symbol name : type [= "variant"]
is a synonim oftype
and can be
used to ascribe a type to a symbol. External symbols must be matched by
a declaration in OCaml, and when the symbol is overloaded the variant
label is used for the matching (additionally to the name).
- The
-
Compiler:
- The type checker is in charge of resolving all symbols, overloaded or not,
to aSymbol.t
datatype that gathers theLoc.t
where it is defined
(and it can be defined at multiple places, e.g. OCaml + Elpi, or twice
in Elpi). This data can be used to implement jump-to-def and the like in
modern UIs. - The
determinacy_checker
statically analyzes whether a predicate labeled
as functional adheres to its signature. - The elaboration of
{spilling}
has been moved to a dedicated file. - CHR rules are typechecked (finally)
- Macros are typechecked. This paves the way to make them live in name
spaces and possibly globally available, but it is not implemented yet.
- The type checker is in charge of resolving all symbols, overloaded or not,
-
Runtime:
- Builtin predicates now have a dedicated node when they are part of the
Elpi language, i.e. Cut, And, Impl, RImpl, Pi, Sigma, Eq, Match, Findall,
Delay. - Symbols part of the Elpi language (other than the builtins) also have
a dedicated status, i.e. As, Uv, ECons, ENil although As and Uv do not
have a dedicated node in the AST, while ENil and ECons do have it.
- Builtin predicates now have a dedicated node when they are part of the
2.0.7
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
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
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 notRawData.t
. The data
typeAst.Term.t
contains locations (for locating type errors) and
has named (bound) variables and type annotations inAst.Type.t
. - New
Compile.extend_signature
andCompile.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
, onlyRawQuery
is available (orCompile.query
)
- Change quotations generate
-
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
aroundA => B
.
-
Language:
- New infix
==>
standing for application but with "the right precedence™",
i.e.A ==> B, C
meansA => (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 ofmap
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
declaresmap
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 tofunc map i:list A, i:(func i:A, o:B), o:list B
. - New type annotations on variables quantified by
pi
as inpi x : term \ ...
- New type casts on terms, as in
f (x : term)
- New attribute
:untyped
to skip the type checking of a rule.
- New infix
-
Stdlib:
- New
std.list.init N E L
builds a listL = [E, ..., E]
with lengthN
- New
std.list.make N F L
builds the listL = [F 0, F 1, ..., F (N-1)]
- New
triple
data type with constructortriple
and projectionstriple_1
...
- New
-
Builtins:
- Remove
string_to_term
,read
,readterm
,quote_syntax
- Remove
-
REPL:
- Remove
-no-tc
,-legacy-parser
,-legacy-parser-available
- New
-document-infix-syntax
- Remove