A JavaScript-like (not-JavaScript) scripting language built from scratch for fun and learning purposes. It’s written in Go, with plans to port the interpreter to C for performance, reduced runtime overhead and lower-level control.
- Dynamic Type System
- Functions/Closures
- Automatic Memory Management
- Block c-style comments
- Multi-line string literals
- Go 1.21+
- Git
git clone https://github.com/peterkwesiansah/bangscript.git
cd bangScript/gbs
go run main.go
git clone https://github.com/peterkwesiansah/bangscript.git
cd bangScript/gbs
go build -o bs
./bs examples/hello.bs
You can find this script in examples/counter.bs
fun makeCounter() {
var count = 0;
fun inc() {
count = count + 1;
print count;
}
return inc;
}
var counter = makeCounter();
counter(); // → 1
counter(); // → 2
counter(); // → 3
- Lexer/Scanner
- Parser
- Resolver
- Tree-walk Interpreter
- Interactive REPL
- Finalizing Closures
- Bytecode VM
This Language is heavily inspired by lox