gopapageno

command module
v0.0.0-...-f855b71 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2017 License: GPL-2.0 Imports: 1 Imported by: 0

README

Go PAPAGENO

Go PAPAGENO (PArallel PArser GENeratOr) is a parallel parser generator based on Floyd's Operator Precedence Grammars.

It generates parallel Go parsers starting from a lexer and a grammar specification. These specification files resemble Flex and Bison ones, although with some differences.

The generated parsers are self-contained and can be used without further effort.

This work is based on Papageno, a C parallel parser generator.

Installation
go get github.com/simoneguidi94/gopapageno
Parser generator example
package main

import (
	"github.com/simoneguidi94/gopapageno/generator"
)

func main() {
	generator.Generate("languages/arithmetic/lexer/arith.l", "languages/arithmetic/parser/arith.g", "languages/arithmetic")
}
Parser usage example
package main

import (
    "fmt"

    "github.com/simoneguidi94/gopapageno/languages/arithmetic"
)

func main() {
    root, err := arithmetic.ParseFile("expression.txt", 2)
    
    if err == nil {
        fmt.Printf("Result: %d\n", *root.Value.(*int64))
    } else {
        fmt.Printf("Parse failed!")
        fmt.Println(err.Error())
    }
}
Authors and Contributors

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
languages
xml

Jump to

Keyboard shortcuts

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