CLF.Term
External contextual LF terms.
type t =
| Variable of {
location : Syncom.Location.t;
identifier : Syncom.Identifier.t;
}
Variable { identifier = "x"; _ }
is the LF-bound term-level variable with name "x"
.
| Meta_variable of {
location : Syncom.Location.t;
identifier : Syncom.Identifier.t;
}
Meta_variable { identifier = "x"; _ }
is the meta-variable with name "x"
. It may be free or bound.
| Parameter_variable of {
location : Syncom.Location.t;
identifier : Syncom.Identifier.t;
}
Parameter_variable { identifier = "#x"; _ }
is the term-level parameter variable with name "#x"
. It may be free or bound.
| Constant of {
location : Syncom.Location.t;
identifier : Syncom.Qualified_identifier.t;
}
Constant { identifier = "c"; _ }
is the term-level constant with qualified identifier "c"
.
| Substitution of {
location : Syncom.Location.t;
term : t;
substitution : Substitution.t;
}
Substitution { term; substitution; _ }
is the term term[substitution]
.
| Application of {
location : Syncom.Location.t;
applicand : t;
arguments : t Support.List1.t;
}
Application { applicand; arguments; _ }
is the term-level application of applicand
with arguments
.
If applicand = Term.Constant _
with resolved operator description operator
, then List1.length arguments = Operator.arity operator
.
| Abstraction of {
location : Syncom.Location.t;
parameter_identifier : Syncom.Identifier.t Support.Option.t;
parameter_type : Typ.t Support.Option.t;
body : t;
}
Abstraction { parameter_identifier = Option.Some "x"; body; _ }
is the term \x. body
.Abstraction { parameter_identifier = Option.None; body; _ }
is the term \_. body
.| Hole of {
location : Syncom.Location.t;
variant : [ `Underscore | `Unlabelled | `Labelled of Syncom.Identifier.t ];
}
Hole { variant; _ }
is the omission of a term for reconstruction.
variant = `Underscore
, then it is the hole _
.variant = `Unlabelled
, then it is the hole ?
.variant = `Labelled label
, then it is the hole ?label
.| Tuple of {
location : Syncom.Location.t;
terms : t Support.List1.t;
}
Tuple { terms; _ }
is the tuple term <t1; t2; ...; tn>
if List1.to_list terms = [t1; t2; ...; tn]
.
This should not be confused with computation-level tuples. The type of a contextual LF term-level tuple is a block.
*)| Projection of {
location : Syncom.Location.t;
term : t;
projection : [ `By_identifier of Syncom.Identifier.t
| `By_position of Support.Int.t ];
}
Projection { term = u; projection = `By_identifier x; _ }
is the term u.x
.Projection { term = u; projection = `By_position n; _ }
is the term u.n
.| Type_annotated of {
location : Syncom.Location.t;
term : t;
typ : Typ.t;
}
Type_annotated { term = u; typ = t; _ }
is the term u : t
.
module Pattern : sig ... end
External contextual LF term patterns.