Original name, right?
If you're just getting started, check the wiki! (Wiki is out of date and contains some really old, phased-out syntax - peruse at your own risk)
Please don't use this for anything real, it's just a toy language.
; Calculates n factorial (n!).
fact {
; duplicate and compare to zero
^ 0 ==
br {
.@
; pop off to nothing, and push a 1
.@ 1
}
el {
.@
.x ; pop into x
x 1 - ; push a copy and subtract 1 from it
fact ; call factorial
x * ; multiply whatever our factorial is by x
}
}
main {
@ 5 4 3 2 1
loop { fact println }
}
This project requires Rust 1.19 stable (nightly and beta should also work).
git clone https://github.com/alekratz/sbl-rs
cd sbl
cargo build
If you want to build a release version, tack --release
to the end of the
cargo
invocation.
Optionally if you want to run sbl
from the command line, run
cargo install
. Otherwise, you can run the program from
target/{debug,release}/sbl file.sbl
or cargo run -- file.sbl
.
All SBL supports right now is running directly from a file. If you wish to import code from multiple files, multiple files may be supplied from the command line.
sbl test.sbl
Note that SBL files must not contain duplicate functions; this is a compile-time error if they do.
You can check out the grammar in GRAMMAR.md.
- Terse syntax
- Tacit-style programming
- Recursive functions
- Order-agnostic function definition
- Simple, LL(0) grammar
- Built-in function support
- A handful of primitive types
- File path imports
- Include paths, too!
- Ability to call (some) foreign functions
- More to come...
Or, "room for improvement"
Check out the planned feature tag on the issues page.
This is the list of features that are officially planned and ready to be implemented that have not yet been added. All features are open for discussion.
None yet!
Contributions are welcome and happily accepted. Check out CONTRIBUTING.md for more details.
Apache2. See LICENSE file for details.