{"id":13615495,"url":"https://github.com/flowbased/fbp","last_synced_at":"2025-04-06T16:12:46.992Z","repository":{"id":8703973,"uuid":"10370136","full_name":"flowbased/fbp","owner":"flowbased","description":"FBP flow definition language parser","archived":false,"fork":false,"pushed_at":"2023-01-16T03:03:13.000Z","size":345,"stargazers_count":115,"open_issues_count":14,"forks_count":19,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-30T14:11:14.320Z","etag":null,"topics":["dsl","fbp","parser"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flowbased.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-29T21:47:56.000Z","updated_at":"2024-12-02T12:54:13.000Z","dependencies_parsed_at":"2023-01-16T19:45:22.536Z","dependency_job_id":null,"html_url":"https://github.com/flowbased/fbp","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Ffbp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Ffbp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Ffbp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flowbased%2Ffbp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flowbased","download_url":"https://codeload.github.com/flowbased/fbp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509235,"owners_count":20950232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsl","fbp","parser"],"created_at":"2024-08-01T20:01:14.442Z","updated_at":"2025-04-06T16:12:46.963Z","avatar_url":"https://github.com/flowbased.png","language":"JavaScript","readme":"FBP flow definition language parser\n===================================\n\nThe *fbp* library provides a parser for a domain-specific language for flow-based-programming (FBP),\nused for defining graphs for FBP programming environments like\n[NoFlo](https://noflojs.org), [MicroFlo](https://microflo.org) and [MsgFlo](http://msgflo.org).\n\n## Usage\n\nYou can use the FBP parser in your JavaScript code with the following:\n\n```javascript\nvar parser = require('fbp');\n\n// Some FBP syntax code\nvar fbpData = \"'hello, world!' -\u003e IN Display(Output)\";\n\n// Parse into a Graph definition JSON object\nvar graphDefinition = parser.parse(fbpData, {caseSensitive: true});\n```\n\nWhen `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.\n\n\n### Command-line\n\nThe *fbp* package also provides a command-line tool for converting FBP files into JSON:\n\n```\n$ fbp somefile.fbp [--case-sensitive] \u003e somefile.json\n```\n\nAnd for converting JSON files into FBP:\n\n```\n$ fbp somefile.json [--case-sensitive] \u003e somefile.fbp\n```\n\n\n## Language for Flow-Based Programming\n\nFBP is a Domain-Specific Language (DSL) for easy graph definition. The syntax is the following:\n\n* `'somedata' -\u003e PORT Process(Component)` sends initial data _somedata_ to port _PORT_ of process _Process_ that runs component _Component_\n* `A(Component1) X -\u003e 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_\n\nYou can connect multiple components and ports together on one line, and separate connection definitions with a newline or a comma (`,`).\n\nComponents only have to be specified the first time you mention a new process. Afterwards, simply use the process name.\n\nExample:\n\n```fbp\n'somefile.txt' -\u003e SOURCE Read(ReadFile) OUT -\u003e IN Split(SplitStr)\nSplit OUT -\u003e IN Count(Counter) COUNT -\u003e IN Display(Output)\nRead ERROR -\u003e IN Display\n```\n\nThe syntax also supports blank lines and comments. Comments start with the `#` character.\n\nExample with the same graph than above :\n\n```fbp\n# Read the content of \"somefile.txt\" and split it by line\n'somefile.txt' -\u003e SOURCE Read(ReadFile) OUT -\u003e IN Split(SplitStr)\n\n# Count the lines and display the result\nSplit() OUT -\u003e IN Count(Counter) COUNT -\u003e IN Display(Output)\n\n# The read errors are also displayed\nRead() ERROR -\u003e IN Display()\n```\n\n### Exporting ports\n\nWhen 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.\n\nExample:\n\n```fbp\nINPORT=Read.IN:FILENAME\nRead(ReadFile) OUT -\u003e IN Display(Output)\n```\n\nThis line would export the *IN* port of the *Read* node as *FILENAME*.\n\n### Node metadata\n\nIt is possible to append metadata to Nodes when declaring them by adding the metadata string to the Component part after a colon (`:`).\n\nExample:\n\n```fbp\n'somefile.txt' -\u003e SOURCE Read(ReadFile:main)\nRead() OUT -\u003e IN Split(SplitStr:main)\nSplit() OUT -\u003e IN Count(Counter:main)\nCount() COUNT -\u003e IN Display(Output:main)\nRead() ERROR -\u003e IN Display()\n```\n\nIn 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:\n\n```fbp\nRead() OUT -\u003e IN Split(SplitStr:foo=bar,baz=123)\n```\n\nIn this case the *Split* node would contain the metadata keys `foo` and `baz` with values `bar` and `123`.\n\n### Annotations\n\nFBP graphs also support annotations for specifying things like graph name, description, icon, or the FBP runtime to be used for executing the graph.\n\nThe syntax for annotations is `# @name value`, for example:\n\n```fbp\n# @runtime noflo-nodejs\n# @name ReadSomefile\n'somefile' -\u003e SOURCE Read(ReadFile)\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowbased%2Ffbp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflowbased%2Ffbp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflowbased%2Ffbp/lists"}