bendscript.com
homecliexamplessource codesyntax
  • BendScript Programming Language
  • SYNTAX LIBRARY
  • COMMAND LINE
    • telebend
    • transbend
    • newbend
    • intrabend
    • cobend
  • EXAMPLES
    • circumference
    • bitonic sort
  • SOURCE CODE
  • Language Syntax
    • main
    • function
    • let
    • if/else
    • swit.ch
    • type.loop
    • bend.loop
    • fold.loop
    • redact
Powered by GitBook
On this page

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:

  • https://www.npmjs.com/package/bendscript

  • https://www.bendscript.com/language-syntax

  • https://www.bendscript.com/language-syntax/redact

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
PreviousBendScript Programming LanguageNextCOMMAND LINE

Last updated 1 year ago