auto

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package auto compiles a parsed relapse grammar into a visual pushdown automaton and executes it. Compilation into a VPA may result in an exponential explosion, since fully converting a grammar to VPA is O(2^n^2). Rather use the mem package. It gives comparable speed and has no exponential behaviour. This package is just here to provide a benchmark against the mem package.

Index

Constants

This section is empty.

Variables

View Source
var ErrTooManyStates = errors.New("a state explosion has occured")

TODO document

Functions

This section is empty.

Types

type Auto

type Auto struct {
	// contains filtered or unexported fields
}

Auto is the structure that represents the automaton.

func Compile

func Compile(g *ast.Grammar) (*Auto, error)

Compile compiles a parsed relapse grammar ast into a visual pushdown automaton.

func CompileRecord

func CompileRecord(g *ast.Grammar) (*Auto, error)

CompileRecord compiles a parsed relapse grammar and optimizes it for the case where the input structures are records.

func (*Auto) Validate

func (auto *Auto) Validate(p parser.Interface) (bool, error)

Validate executes an automaton with the given parser and returns whether the parser is valid given the automaton's original grammar.

Jump to

Keyboard shortcuts

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