bootstrap

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: BSD-3-Clause Imports: 10 Imported by: 15

Documentation

Overview

Package bootstrap implements the scanner and parser to bootstrap the PEG parser generator.

It parses the PEG grammar into an ast that is then used to generate a parser generator based on this PEG grammar. The generated parser can then parse the grammar again, without the bootstrap package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

Parser holds the state to parse the PEG grammar into an abstract syntax tree (AST).

func NewParser

func NewParser() *Parser

NewParser creates a new Parser.

func (*Parser) Parse

func (p *Parser) Parse(filename string, r io.Reader) (*ast.Grammar, error)

Parse parses the data from the reader r and generates the AST or returns an error if it fails. The filename is used as information in the error messages.

type Scanner

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

Scanner tokenizes an input source for the PEG grammar.

func (*Scanner) Init

func (s *Scanner) Init(filename string, r io.Reader, errh func(ast.Pos, error))

Init initializes the scanner to read and tokenize text from r.

func (*Scanner) Scan

func (s *Scanner) Scan() (Token, bool)

Scan returns the next token, along with a boolean indicating if EOF was reached (false means no more tokens).

type Token

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

Token is a syntactic token generated by the scanner.

func (Token) String

func (t Token) String() string

Directories

Path Synopsis
cmd
bootstrap-build
Command bootstrap-build bootstraps the PEG parser generator by parsing the bootstrap grammar and creating a basic parser generator sufficiently complete to parse the pigeon PEG grammar.
Command bootstrap-build bootstraps the PEG parser generator by parsing the bootstrap grammar and creating a basic parser generator sufficiently complete to parse the pigeon PEG grammar.
bootstrap-pigeon
Command bootstrap-pigeon generates a PEG parser from a PEG grammar to bootstrap the pigeon command-line tool, as it is built using a simplified bootstrapping grammar that understands just enough of the pigeon grammar to parse it and build the tool.
Command bootstrap-pigeon generates a PEG parser from a PEG grammar to bootstrap the pigeon command-line tool, as it is built using a simplified bootstrapping grammar that understands just enough of the pigeon grammar to parse it and build the tool.
pegparse
Command pegparse is a helper command-line tool to test the bootstrap parser.
Command pegparse is a helper command-line tool to test the bootstrap parser.
pegscan
Command pegscan is a helper command-line tool to test the bootstrap scanner.
Command pegscan is a helper command-line tool to test the bootstrap scanner.
static_code_generator
Simple program to generate variables with the static code for the builder based on real .go source files.
Simple program to generate variables with the static code for the builder based on real .go source files.

Jump to

Keyboard shortcuts

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