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:
# start project
npm init -y
# get syntax library
npm install bendscript
/*{*/
import { type, recursive } from 'bendscript';
/*}*/
// a binary tree
type.loop(`MyTree`)
.branch(`Node`, [
'val',
recursive('left'),
recursive('right'),
])
.branch(`Leaf`, [])
# run transpiler
telebend -i ./example-syntax-in.bs -o ./example-syntax-out.bend
# a binary tree
type MyTree:
Node { val, ~left, ~right }
Leaf
Last updated