Skip to content
Symbiont is a purpose-built language for expressive data manipulations.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
_config.yml
composer.json
grumphp.yml
phpcs.xml
phpmd.xml
phpstan.neon
phpunit.xml

README.md

Introduction

Symbiont is a purpose-built language for expressive data manipulation. It is named so, because it relies on a mutualistic symbiotic relationship with a host language.

As an expressive scripting language, Symbiont is able to keep and update state of data, as well as consume from and publish to external data sources. The extent of these capabilities heavily rely on the host language and implementation with that language.

By design, the language is intended to be decoupled from the host language. The main host language is PHP. However, the syntax is purposely designed around Vaughan Pratt's Top Down Operator Precedence. The implementation details are referenced from Douglas Crockford's paper on a parser for Simplified JavaScript that is written in Simplified Javascript.

Syntax example

A brief example of the syntax:

$catalog = @products;
$product = $catalog.ensure('tnt');

$product.branch('media_gallery_entries.*').filter(
  $image => $image.get('file')/portrait\.(jpg|png)$/;
);

The example consists of:

  • Variable $catalog pointing to a storage named products.
  • Variable $product pointing to an entity tnt from storage products.
  • Variable $image pointing to an image node, within the $product data structure.

The following operations are performed:

  1. Variable $catalog points to storage products.
  2. Variable $product points to storage products entry tnt. If entry tnt could not be found, it is created according to a predetermined structure, specific to the products storage.
  3. For each child of the media_gallery_entries data node of $product, a filter is applied. Only entries with a file that ends in portrait.jpg or portrait.png is kept.
  4. End of program clean-up is triggered. This ensures the modifications on $product are persisted to the products storage.
You can’t perform that action at this time.