ast

package
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: 2 Imported by: 0

Documentation

Overview

Package ast defines abstract syntax tree for expressing on σ-calculus

Examples on the usage of ast Generator is a σ-expressions producing stream of binary relations imdb(s, p, o) ⇒ ⟨subject, predicate, object⟩.

&ast.Fact{Stream: }

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fact

type Fact Imply

σ-expression, Generator of ground facts TODO: deprecate type (see Head)

func NewFact

func NewFact(name string) *Fact

Helper instantiates Fact Node

func (*Fact) Node

func (*Fact) Node() Kind

func (*Fact) Rule

func (*Fact) Rule() Kind

func (*Fact) Tuple

func (f *Fact) Tuple(term ...string) *Fact

Helper configs Fact Node with Terms

type Head Imply

Head of Horn clause

func NewHead

func NewHead(name string) *Head

func (*Head) Tuple

func (f *Head) Tuple(term ...string) *Head

Helper configs Fact Node with Terms

type Horn

type Horn struct {
	Head *Head
	Body Implies
}

Horn clause is a syntax sugar for the projection (⟻) and join (⨝) operator It joins body and projects result as stream defined by the head.

H ⟻ A ⨝ B ⨝ ... ⨝ C

func NewHorn

func NewHorn(head *Head, imply ...*Imply) *Horn

func (*Horn) Node

func (*Horn) Node() Kind

func (*Horn) Rule

func (*Horn) Rule() Kind

type Implies

type Implies []*Imply

Sequence of σ-expressions

type Imply

type Imply struct {
	Name  string
	Terms Terms
}

σ-expression

func NewExpr

func NewExpr(name string) *Imply

func (*Imply) Term

func (i *Imply) Term(term string, value ...xsd.Value) *Imply

type Kind

type Kind int

Kind of ast node

const (
	Invalid Kind = iota
	NodeTerm
	NodeFact
	NodeHorn
)

type Rule

type Rule interface{ Rule() Kind }

σ-expression

type Rules

type Rules []Rule

type Term

type Term struct {
	Name  string
	Value xsd.Value
}

Term defines complex term expressions of σ-expression

func (*Term) Node

func (*Term) Node() Kind

func (*Term) String

func (x *Term) String() string

type Terms

type Terms []*Term

Terms is the ordered set of terms

Jump to

Keyboard shortcuts

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