compiler

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 16 Imported by: 0

README

Ride PEG parser and compiler

Install PEG generator

Ride's PEG grammar is located in ride.peg file. Lines under # Go part section is Go related and can be removed in other implementations.

In order to generate PEG parser, please, install project https://github.com/pointlander/peg.

go install github.com/pointlander/peg@latest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(code string, compact, removeUnused bool) ([]byte, []error)

func CompileToTree

func CompileToTree(code string) (*ast.Tree, []error)

func Pretty

func Pretty(pretty bool) func(*Parser) error

func Size

func Size(size int) func(*Parser) error

Types

type Compaction

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

func NewCompaction

func NewCompaction(tree *ast.Tree) Compaction

func (*Compaction) Compact

func (c *Compaction) Compact()

type Parser

type Parser struct {
	Buffer string

	Pretty bool
	// contains filtered or unexported fields
}

func (*Parser) AST

func (t *Parser) AST() *node32

func (*Parser) Add

func (t *Parser) Add(rule pegRule, begin, end, index uint32)

func (*Parser) Init

func (p *Parser) Init(options ...func(*Parser) error) error

func (*Parser) Parse

func (p *Parser) Parse(rule ...int) error

func (*Parser) PrettyPrintSyntaxTree

func (t *Parser) PrettyPrintSyntaxTree(buffer string)

func (*Parser) Print

func (t *Parser) Print()

func (*Parser) PrintSyntaxTree

func (p *Parser) PrintSyntaxTree()

func (*Parser) Reset

func (p *Parser) Reset()

func (*Parser) SprintSyntaxTree

func (p *Parser) SprintSyntaxTree() string

func (*Parser) Tokens

func (t *Parser) Tokens() []token32

func (*Parser) Trim

func (t *Parser) Trim(length uint32)

func (*Parser) WriteSyntaxTree

func (p *Parser) WriteSyntaxTree(w io.Writer)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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