All Projects → flowbased → Fbp

flowbased / Fbp

FBP flow definition language parser

Programming Languages

javascript
184084 projects - #8 most used programming language
dsl
153 projects

Labels

Projects that are alternatives of or similar to Fbp

Codecharta
CodeCharta visualizes multiple code metrics using 3D tree maps.
Stars: ✭ 85 (-8.6%)
Mutual labels:  parser
Sax Wasm
The first streamable, fixed memory XML, HTML, and JSX parser for WebAssembly.
Stars: ✭ 89 (-4.3%)
Mutual labels:  parser
Csv Parser
Fast, header-only, extensively tested, C++11 CSV parser
Stars: ✭ 90 (-3.23%)
Mutual labels:  parser
Redrun
✨🐌 🐎✨ fastest npm scripts runner
Stars: ✭ 85 (-8.6%)
Mutual labels:  parser
Psd Parser
Photoshop Document Parser for .Net
Stars: ✭ 87 (-6.45%)
Mutual labels:  parser
Mediawiki
MediaWiki API wrapper in python http://pymediawiki.readthedocs.io/en/latest/
Stars: ✭ 89 (-4.3%)
Mutual labels:  parser
Internettools
XPath/XQuery 3.1 interpreter for Pascal with compatibility modes for XPath 2.0/XQuery 1.0/3.0, custom and JSONiq extensions, XML/HTML parsers and classes for HTTP/S requests
Stars: ✭ 82 (-11.83%)
Mutual labels:  parser
Tree Sitter Python
Python grammar for tree-sitter
Stars: ✭ 92 (-1.08%)
Mutual labels:  parser
Diffsitter
A tree-sitter based AST difftool to get meaningful semantic diffs
Stars: ✭ 89 (-4.3%)
Mutual labels:  parser
Go
A high-performance 100% compatible drop-in replacement of "encoding/json"
Stars: ✭ 10,248 (+10919.35%)
Mutual labels:  parser
Beanbun Parser
beanbun-parser 是 Beanbun 的数据抽取插件。抽取规则的选择器语法类似于 jQuery,使用简单。
Stars: ✭ 86 (-7.53%)
Mutual labels:  parser
Markup
Lightweight markup text formatting in Swift
Stars: ✭ 88 (-5.38%)
Mutual labels:  parser
Rst
PHP library to parse reStructuredText documents
Stars: ✭ 90 (-3.23%)
Mutual labels:  parser
I Pascal
A free Object Pascal language plugin for IntelliJ IDEA
Stars: ✭ 85 (-8.6%)
Mutual labels:  parser
Libdparse
Library for lexing and parsing D source code
Stars: ✭ 91 (-2.15%)
Mutual labels:  parser
Blockchain Parser
The simpliest script for parsing Bitcoin blockchain. It made convertion of blk*****.dat files to the simple text.
Stars: ✭ 84 (-9.68%)
Mutual labels:  parser
Udt
UDT spec, reference library and related packages
Stars: ✭ 89 (-4.3%)
Mutual labels:  parser
Postcss Less
PostCSS Syntax for parsing LESS
Stars: ✭ 93 (+0%)
Mutual labels:  parser
Java
jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
Stars: ✭ 1,308 (+1306.45%)
Mutual labels:  parser
Kiss Headers
💡Python package for HTTP/1.1 style headers. Parse headers to objects. Most advanced available structure for http headers.
Stars: ✭ 91 (-2.15%)
Mutual labels:  parser

FBP flow definition language parser

The fbp library provides a parser for a domain-specific language for flow-based-programming (FBP), used for defining graphs for FBP programming environments like NoFlo, MicroFlo and MsgFlo.

Usage

You can use the FBP parser in your JavaScript code with the following:

var parser = require('fbp');

// Some FBP syntax code
var fbpData = "'hello, world!' -> IN Display(Output)";

// Parse into a Graph definition JSON object
var graphDefinition = parser.parse(fbpData, {caseSensitive: true});

When caseSensitive is false the parser will convert port names to lowercase. This is currently the default behavior, but in future releases the default will change to preserve case. It is therefore recommended that you always specify the caseSensitive option to make your code future-proof.

Command-line

The fbp package also provides a command-line tool for converting FBP files into JSON:

$ fbp somefile.fbp [--case-sensitive] > somefile.json

And for converting JSON files into FBP:

$ fbp somefile.json [--case-sensitive] > somefile.fbp

Language for Flow-Based Programming

FBP is a Domain-Specific Language (DSL) for easy graph definition. The syntax is the following:

  • 'somedata' -> PORT Process(Component) sends initial data somedata to port PORT of process Process that runs component Component
  • A(Component1) X -> Y B(Component2) sets up a connection between port X of process A that runs component Component1 and port Y of process B that runs component Component2

You can connect multiple components and ports together on one line, and separate connection definitions with a newline or a comma (,).

Components only have to be specified the first time you mention a new process. Afterwards, simply use the process name.

Example:

'somefile.txt' -> SOURCE Read(ReadFile) OUT -> IN Split(SplitStr)
Split OUT -> IN Count(Counter) COUNT -> IN Display(Output)
Read ERROR -> IN Display

The syntax also supports blank lines and comments. Comments start with the # character.

Example with the same graph than above :

# Read the content of "somefile.txt" and split it by line
'somefile.txt' -> SOURCE Read(ReadFile) OUT -> IN Split(SplitStr)

# Count the lines and display the result
Split() OUT -> IN Count(Counter) COUNT -> IN Display(Output)

# The read errors are also displayed
Read() ERROR -> IN Display()

Exporting ports

When FBP-defined graphs are used as subgraphs in other flows, it is often desirable to give more user-friendly names to their available ports. In the FBP language this is done by INPORT and OUTPORT statements.

Example:

INPORT=Read.IN:FILENAME
Read(ReadFile) OUT -> IN Display(Output)

This line would export the IN port of the Read node as FILENAME.

Node metadata

It is possible to append metadata to Nodes when declaring them by adding the metadata string to the Component part after a colon (:).

Example:

'somefile.txt' -> SOURCE Read(ReadFile:main)
Read() OUT -> IN Split(SplitStr:main)
Split() OUT -> IN Count(Counter:main)
Count() COUNT -> IN Display(Output:main)
Read() ERROR -> IN Display()

In this case the route leading from Read to Display through Split and Count would be identified with the string main. You can also provide arbitrary metadata keys with the = syntax:

Read() OUT -> IN Split(SplitStr:foo=bar,baz=123)

In this case the Split node would contain the metadata keys foo and baz with values bar and 123.

Annotations

FBP graphs also support annotations for specifying things like graph name, description, icon, or the FBP runtime to be used for executing the graph.

The syntax for annotations is # @name value, for example:

# @runtime noflo-nodejs
# @name ReadSomefile
'somefile' -> SOURCE Read(ReadFile)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].