Skip to content

A JavaScript-like (not-JavaScript) scripting language built from scratch for fun and learning purposes.

Notifications You must be signed in to change notification settings

PeterKwesiAnsah/bangScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

BangScript

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.

Features

  • Dynamic Type System
  • Functions/Closures
  • Automatic Memory Management
  • Block c-style comments
  • Multi-line string literals
Getting Started
Requirements
  • Go 1.21+
  • Git
To run the REPL
git clone https://github.com/peterkwesiansah/bangscript.git
cd bangScript/gbs
go run main.go
or a script
git clone https://github.com/peterkwesiansah/bangscript.git
cd bangScript/gbs
go build -o bs
./bs examples/hello.bs
Running a Real Script

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

What's Next

  • Lexer/Scanner
  • Parser
  • Resolver
  • Tree-walk Interpreter
  • Interactive REPL
  • Finalizing Closures
  • Bytecode VM

Credits

This Language is heavily inspired by lox

About

A JavaScript-like (not-JavaScript) scripting language built from scratch for fun and learning purposes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published