LLZK 0.1.0
Veridise's ZK Language IR
|
bool
: subtype of Felt in [0,1]int
: machine integerFelt
: finite field elementstruct
(component): Aggregate type with named heterogeneous elements. Generally correlates to components/functions in the source language. Constituent elements may be local variables, subcomponents, and/or called functions.array<E>
: elements can be any type, including other array type for multi-dimensional arrays. We may need this type to have a built-in field named len
that returns the length of the array.const<T>
: modifier on types to denote it’s a compile-time constant. Semantic analysis can infer const
based on usage of literal values, etc. but it can also be specified in the IR in which case the semantic analysis must ensure it’s correct or give an error. The semantics of several syntax nodes require a const
value, such as the i
in GetWeight<i>.compute()
. Global function return type can be const
and that would allow such a function to be used in these locations.nondetFelt()
: can be used as the parameter of a constrain()
function when the expression from the source language can be elided because it cannot be used as part of a constraint. For example, expressions containing bitwise operators cannot be part of a constraint.struct
to store the return value of a component (i.e. synthetic_return
in the examples above).emit
must only appear in constrain()
functions and return
only in global functions.constrain()
only calls constrain()
and compute()
only calls compute()
. Either can call arbitrary functions but not each other.a.b
, a field named b
must be present in the component a
. For references like c
, if a field named c
is present in the current component the reference refers to that field instance, otherwise it refers to a local named c
within that function, with type inferred from the RHS of the expression where c
is defined.pub
can be added before the type on compute()
and constrain()
parameters to denote which elements of the domain are public (default is private). Likewise, it can be used on struct fields to denote which fields are part of the co-domain (i.e. public outputs).struct
can be used to avoid creating multiple versions of that struct
in the IR. A later pass can flatten the IR if needed by the client analysis. This is even where multiple dialects of the IR could be used, with a flattened dialect disallowing these parameters.scf.for
should be used to make loop bounds explicit. However, scf.while
is available to handle the general case if that information is not available but this should not be used in the constrain()
function.struct
definitions) are pure. There is no global state and parameters are pass-by-value (i.e. a copy is created) so there is nothing external they can modify.veridise.lang = "llzk"
attribute (because the presence of that attribute is used to determine the “root” symbol table for symbol resolution).