merak

package module
v0.0.0-...-c1b9d22 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

Merak

Merak is an LR(1) parser library for Go written in Go, But it is not a code generator.
Merak 是一个用Go编写的Go LR(1) parser 库,但不是一个代码生成器

Install

go get github.com/Orlion/merak

Getting Started

  1. New A Parser
parser := merak.NewParser()
  1. Register Production
parser.RegProduction(...)
parser.RegProduction(...)
...
  1. Parse Input
r, err := parser.Parse(SymbolGOAL, SymbolEoi, lexer)

Example

calculator

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SyntaxErr = errors.New("syntax error")
)

Functions

This section is empty.

Types

type Parser

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

func NewParser

func NewParser() *Parser

func (*Parser) Parse

func (parser *Parser) Parse(goal symbol.Symbol, eoi symbol.Symbol, l lexer.Lexer) (result symbol.Value, err error)

Parse Input

func (*Parser) RegProduction

func (parser *Parser) RegProduction(result symbol.Symbol, params []symbol.Symbol, callback item.Callback) (err error)

Register production to this parser

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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