oleksandr / fbp

A Go parser for .FBP DSL language from NoFlo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoFlo's FBP DSL parser for Go

A Go parser for .FBP DSL language from NoFlo

Dependencies

This is optional. If you want to update the parser's code based on the grammer.peg you need to install the following dependency:

go get github.com/pointlander/peg

This will download and compile peg binary, which you can use later to generate the parser.

The following command will generate the parser:

peg -switch -inline grammar.peg

Installation

Use regular go install or go get command to download and install the fbp library:

go get github.com/oleksandr/fbp

The library already includes the generated parser.

Basic usage

import "github.com/oleksandr/fbp"

var graph string = `
    '5s' -> INTERVAL Ticker(core/ticker) OUT -> IN Forward(core/passthru)
    Forward OUT -> IN Log(core/console)`

parser := &fbp.Fbp{Buffer: graph}
parser.Init()
err := parser.Parse()
if err != nil {
    t.Log(err.Error())
    t.Fail()
}
parser.Execute()
if err = parser.Validate(); err != nil {
    t.Log(err.Error())
    t.Fail()
}

// At this point you have parser.Processes, parser.Connections, 
// parser.Inports and parser.Outports data structures...

About

A Go parser for .FBP DSL language from NoFlo

License:MIT License


Languages

Language:Go 100.0%