Type Declarations
Struct
struct declaration include a name, optional generic arguments and a list of fields. The fields in turn have a name and a type which may use the generic arguments.
struct Empty {}
struct NonGeneric {
field_a: Type used to represent signed integers. The generic parameter (<N>) specReturns the value of the first branch if the condition is true, otherwise the second branch.
Note that unlike software languages, Spade does not have conditional execution. You do not conditionally assign values inside if expressiosn, you compute a value and return it.ies the number of bits,
field_b: Type used to represent 1 bit values
}
struct Generic<T> {
field_a: T,
field_b: Type used to represent 1 bit values
}Enum
enum declarations also include a name and optional generic arguments. Their body consists of a list of variants. Each variant in turn has a name, and an optional list of fields
enum Enum {
EmptyVariant,
OneField{val: Type used to represent signed integers. The generic parameter (<N>) specReturns the value of the first branch if the condition is true, otherwise the second branch.
Note that unlike software languages, Spade does not have conditional execution. You do not conditionally assign values inside if expressiosn, you compute a value and return it.ies the number of bits}
TwoFields{val1: Type used to represent 1 bit values, val2: Type used to represent 1 bit values}
}
enum GenericEnum<T> {
EmptyVariant,
OneField{val: T}
}