Repository navigation
Base Operations
NanoBB has a lisp-inspired syntax. It expands on S-Expressions to have a few separate enclosures that represent different syntax and data-types. Here is a baseline of what each of these brackets and patterns represent and how they operate.
NanoBB uses S-Expressions for every function call. You can call functions by simply using the () syntax. for example:
// Returns 9
(+ 4 5)
// Set Variable 'x' to "Hello, World!"
(= x "Hello, World!")
NanoBB supports object-oriented programming through the "table" datatype. This functions about the same as a JavaScript Object and can be created simply through the [] syntax. This also can function as a Lisp quote.
// Set Variable 'x' to {0: 1, 1: 2, 2: 3}
(= x [1 2 3])
// Prints x[0] to the Console
(print (. x 0))
(Note: This doesn't work the same as an array. Arrays are defined using (arr a1 a2 a...) which allows the usage of the pop and push function)
NanoBB has a shorthand for making functions through Lambda Notation. The way you write a function is through the (){} syntax. This is also the only way to define functions.
(= main (){
//Basic Program Entrance
(pass)
})
(Note: No functions can be empty. You should use the pass function when not including any code)
Another syntax which uses the {} brackets are code blocks. The way you write blocks of code for things like if statements is through the ({}) syntax. This might cause errors when included in functions that don't expect more than a single value as an argument so use carefully (Might be revised in release)
//'maybe' value is included in Esoteric API
(if maybe ({
//If True
(pass)
})({
//If False
(pass)
}))
//Note: It isn't required
(if maybe (pass) (pass))