sigma

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2023 License: AGPL-3.0 Imports: 7 Imported by: 1

README

sigma

algebra of σ-calculus

Quick Example

rules := ast.Rules{/* rules of σ-expression */}

machine, err := sigma.New(/* goal */, rules)
if err != nil {
	panic(err)
}

ctx := asm.NewContext().Add(/* add generators */)
reader := sigma.Stream(ctx, machine)

reader.ToSeq()

Internal

  • ast - abstract syntax tree to define the σ-calculus expression
  • internal/complier - compiles the σ-calculus expression into assembler ("byte code")
  • asm - assembler of the VM
  • vm - Sigma VM
// Compile phase
rules := ast.Rules{/* rules of σ-expression */}

build := compiler.New()
build.Compile(rules)

machine, shape, obj := c.Assemble(/* goal */)

// Execution phase
ctx := asm.NewContext().Add(/* add generators */)

stream := obj.Link(ctx)
reader := machine.Stream(shape, stream)

reader.ToSeq()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(vm *VM) ([]byte, error)

Types

type Reader

type Reader interface {
	ToSeq() [][]xsd.Value
	Read([]xsd.Value) error
}

Reader is a stream produced by evaluation of rules

func NewReader

func NewReader(ctx *asm.Context, goal string, rules ast.Rules) (Reader, error)

func Stream

func Stream(ctx *asm.Context, vm *VM) Reader

type VM

type VM struct {
	Machine *vm.VM
	Shape   []vm.Addr
	Code    asm.Stream
}

func Decode

func Decode(buf []byte) (*VM, error)

func New

func New(goal string, rules ast.Rules) (*VM, error)

Create instance of VM

Directories

Path Synopsis
Package ast defines abstract syntax tree for expressing on σ-calculus
Package ast defines abstract syntax tree for expressing on σ-calculus
internal
gen

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL