Documentation
¶
Index ¶
- Constants
- func DecodeList[T any](d *decoder, decoderFunc func(*decoder) (T, error)) ([]T, error)
- func Encode[T Binder](program *Program[T]) ([]byte, error)
- func EncodeList[T any](e *encoder, items []T, itemEncoder func(*encoder, T) error) error
- func EncodeTerm[T Binder](e *encoder, term Term[T]) error
- func Pretty[T Binder](p *Program[T]) string
- func PrettyTerm[T Binder](t Term[T]) string
- type Apply
- type Binder
- type Bls12_381G1Element
- type Bls12_381G2Element
- type Bls12_381MlResult
- type Bool
- type Builtin
- type ByteString
- type Case
- type Constant
- type Constr
- type Data
- type DeBruijn
- func (n DeBruijn) LookupIndex() int
- func (n DeBruijn) ParameterDecode(d *decoder) (Binder, error)
- func (n DeBruijn) ParameterEncode(e *encoder) error
- func (n DeBruijn) String() string
- func (n DeBruijn) TextName() string
- func (n DeBruijn) VarDecode(d *decoder) (Binder, error)
- func (n DeBruijn) VarEncode(e *encoder) error
- type Delay
- type Error
- type Eval
- type Force
- type IConstant
- type Integer
- type Lambda
- type Name
- type NamedDeBruijn
- func (n NamedDeBruijn) LookupIndex() int
- func (n NamedDeBruijn) ParameterDecode(d *decoder) (Binder, error)
- func (n NamedDeBruijn) ParameterEncode(e *encoder) error
- func (n NamedDeBruijn) String() string
- func (n NamedDeBruijn) TextName() string
- func (n NamedDeBruijn) VarDecode(d *decoder) (Binder, error)
- func (n NamedDeBruijn) VarEncode(e *encoder) error
- type Parser
- type PrettyPrinter
- type Program
- func Decode[T Binder](bytes []byte) (*Program[T], error)
- func NameToDeBruijn(p *Program[Name]) (*Program[DeBruijn], error)
- func NameToNamedDeBruijn(p *Program[Name]) (*Program[NamedDeBruijn], error)
- func NewProgram(version [3]uint32, term Term[Name]) *Program[Name]
- func Parse(input string) (*Program[Name], error)
- type ProtoList
- type ProtoPair
- type String
- type TBls12_381G1Element
- type TBls12_381G2Element
- type TBls12_381MlResult
- type TBool
- type TByteString
- type TData
- type TInteger
- type TList
- type TPair
- type TString
- type TUnit
- type Term
- func AddInteger() Term[Name]
- func DecodeTerm[T Binder](d *decoder) (Term[T], error)
- func IfThenElse() Term[Name]
- func Intern(term Term[Name]) Term[Name]
- func NewApply(function Term[Name], argument Term[Name]) Term[Name]
- func NewBool(value bool) Term[Name]
- func NewBuiltin(fn builtin.DefaultFunction) Term[Name]
- func NewConstant(con IConstant) Term[Name]
- func NewDelay(term Term[Name]) Term[Name]
- func NewForce(term Term[Name]) Term[Name]
- func NewInteger(value *big.Int) Term[Name]
- func NewLambda(parameterName Name, body Term[Name]) Term[Name]
- func NewRawVar(name string) Term[Name]
- func NewSimpleInteger(value int) Term[Name]
- func NewVar(name string, unique Unique) Term[Name]
- func SubtractInteger() Term[Name]
- type Typ
- type Unique
- type Unit
- type Var
Constants ¶
const ( TermTagWidth byte = 4 ConstTagWidth byte = 4 BuiltinTagWidth byte = 7 )
Widths
const ( VarTag byte = 0 DelayTag byte = 1 LambdaTag byte = 2 ApplyTag byte = 3 ConstantTag byte = 4 ForceTag byte = 5 ErrorTag byte = 6 BuiltinTag byte = 7 ConstrTag byte = 8 CaseTag byte = 9 )
Term Tags
const ( IntegerTag byte = 0 ByteStringTag byte = 1 StringTag byte = 2 UnitTag byte = 3 BoolTag byte = 4 DataTag byte = 8 ProtoListOneTag byte = 7 ProtoListTwoTag byte = 5 ProtoPairOneTag byte = 7 ProtoPairTwoTag byte = 7 ProtoPairThreeTag byte = 6 )
Constant Tags
Variables ¶
This section is empty.
Functions ¶
func DecodeList ¶
Decode a list of items with a decoder function. This is byte alignment agnostic. Decode a bit from the buffer. If 0 then stop. Otherwise we decode an item in the list with the decoder function passed in. Then decode the next bit in the buffer and repeat above. Returns a list of items decoded with the decoder function.
func EncodeList ¶
func EncodeTerm ¶
Types ¶
type Bls12_381G1Element ¶
func (Bls12_381G1Element) Typ ¶
func (Bls12_381G1Element) Typ() Typ
type Bls12_381G2Element ¶
func (Bls12_381G2Element) Typ ¶
func (Bls12_381G2Element) Typ() Typ
type Bls12_381MlResult ¶
func (Bls12_381MlResult) Typ ¶
func (Bls12_381MlResult) Typ() Typ
type ByteString ¶
type ByteString struct {
Inner []byte
}
(con bytestring #aaBB)
func (ByteString) Typ ¶
func (bs ByteString) Typ() Typ
type DeBruijn ¶
type DeBruijn int
An index into the Machine's environment which powers var lookups
func (DeBruijn) LookupIndex ¶
func (DeBruijn) ParameterDecode ¶
func (DeBruijn) ParameterEncode ¶
type IConstant ¶
type IConstant interface { Typ() Typ // contains filtered or unexported methods }
func DecodeConstant ¶
type Name ¶
func NewRawName ¶
NewRawName creates a new Name with the provided text and a default Unique value of 0.
func (Name) ParameterDecode ¶
func (Name) ParameterEncode ¶
type NamedDeBruijn ¶
func (NamedDeBruijn) LookupIndex ¶
func (n NamedDeBruijn) LookupIndex() int
func (NamedDeBruijn) ParameterDecode ¶
func (n NamedDeBruijn) ParameterDecode(d *decoder) (Binder, error)
func (NamedDeBruijn) ParameterEncode ¶
func (n NamedDeBruijn) ParameterEncode(e *encoder) error
func (NamedDeBruijn) String ¶
func (n NamedDeBruijn) String() string
func (NamedDeBruijn) TextName ¶
func (n NamedDeBruijn) TextName() string
func (NamedDeBruijn) VarDecode ¶
func (n NamedDeBruijn) VarDecode(d *decoder) (Binder, error)
func (NamedDeBruijn) VarEncode ¶
func (n NamedDeBruijn) VarEncode(e *encoder) error
type PrettyPrinter ¶
type PrettyPrinter struct {
// contains filtered or unexported fields
}
PrettyPrinter manages the state for pretty-printing AST nodes
func NewPrettyPrinter ¶
func NewPrettyPrinter(indentSize int) *PrettyPrinter
NewPrettyPrinter creates a new PrettyPrinter with the specified indent size
type Program ¶
(program 1.0.0 (con integer 1))
func NameToNamedDeBruijn ¶
func NameToNamedDeBruijn(p *Program[Name]) (*Program[NamedDeBruijn], error)
type TBls12_381G1Element ¶
type TBls12_381G1Element struct{}
type TBls12_381G2Element ¶
type TBls12_381G2Element struct{}
type TBls12_381MlResult ¶
type TBls12_381MlResult struct{}
type TByteString ¶
type TByteString struct{}
type Term ¶
type Term[T any] interface { // contains filtered or unexported methods }
func AddInteger ¶
func DecodeTerm ¶
func IfThenElse ¶
func NewBuiltin ¶
func NewBuiltin(fn builtin.DefaultFunction) Term[Name]