Skip to content

Latest commit

 

History

History
47 lines (41 loc) · 1.07 KB

README.md

File metadata and controls

47 lines (41 loc) · 1.07 KB

bason-funky

funky is a parser that makes writing programs in BASON more friendly by adopting a familiar javascript-like function syntax

Syntax

The syntax is universal and simple. Keyword (command, function, or variable) followed by its parameters in parenthesis, followed by its code block in curly brackets (if applicable):

// comment
keyword (parameters, ...) {
  script...
}

defining functions in funky is also similar to javascript:

FUNCTION GREET('name') {
  PRINT(ADD('Hello ', name))
}
GREET('World!')

Funky hoists functions for you so you can declare them anywhere in your file

// still works!
GREET('World!')
FUNCTION GREET('name') {
  PRINT(ADD('Hello ', name))
}

Installation

npm install bason-funky --save

Usage

Import the package, define your program, and parse it with .parse()

let BASON = require('bason')
let funky = require('bason-funky')

BASON.RUN(funky.parse(`
  FUNCTION GREET('name') {
    PRINT(ADD('Hello ', name))
  }
  GREET('World!')
`));