SYNTAX LIBRARY

BendScript is to be coded with a node package manager library imported and surrounded by redaction marks at the top of each script in order to use the advanced parts of the language syntax such as bend and fold. Links to resources:

Using the syntax library:

terminal:
# start project
npm init -y

# get syntax library
npm install bendscript
touch ./example-syntax-in.bs
/*{*/
  import { type, recursive } from 'bendscript';
/*}*/

// a binary tree
type.loop(`MyTree`)
  .branch(`Node`, [
      'val', 
      recursive('left'),
      recursive('right'),
  ])
  .branch(`Leaf`, [])
terminal:
# run transpiler
telebend -i ./example-syntax-in.bs -o ./example-syntax-out.bend
cat ./example-syntax-out.bs
# a binary tree
type MyTree:
  Node { val, ~left, ~right }
  Leaf

Last updated