ThakeeNathees/pocketlang
FreeA lightweight, fast embeddable scripting language.
FreeFree tier
About ThakeeNathees/pocketlang
Pocketlang is a lightweight (~3000 semicolons) and fast object-oriented, embeddable scripting language written in C. It features a Ruby-flavored Python syntax that can be learned within 15 minutes. The language includes a compiler, bytecode VM, and runtime, all packaged as a standalone executable with zero external dependencies. The VM is designed to be easily embedded into host applications. It uses NaN-boxing for efficient dynamic typing and supports tail call optimization for improved performance and memory usage. A WebAssembly build is available for running in browsers. The project is inspired by Wren and the book 'Crafting Interpreters'.
Key Features
Lightweight (~3000 semicolons) and fast
Object-oriented with Ruby-Python hybrid syntax
Zero external dependencies (standalone executable)
Embeddable VM designed for easy integration
NaN-boxing for efficient dynamic type representation
Tail call optimization to reduce memory and prevent stack overflows
WebAssembly build for browser execution
Written in C99-compatible C code
Pros & Cons
Pros
- Extremely lightweight and fast execution
- Zero external dependencies simplifies deployment
- Easy to learn syntax (15-minute learning curve)
- Tail call optimization and NaN-boxing improve performance
- Standalone executable with no build complexity
- Open source with permissive license
Cons
- Pre-alpha status; still in early development
- Documentation is work in progress and may not be up to date
- Limited WebAssembly version (no file I/O, relative imports, etc.)
- Small community and ecosystem compared to established languages
- Not yet suitable for production-critical applications
Best For
Embedding as a scripting language in applicationsGame scripting and automationTeaching programming fundamentalsLightweight scripting for resource-constrained environmentsPrototyping and rapid development
FAQ
What is pocketlang?
Pocketlang is a lightweight, fast, embeddable scripting language written in C. It has a Ruby-flavored Python syntax, uses NaN-boxing for dynamic types, supports tail call optimization, and can be run standalone or embedded in other programs.
How can I build pocketlang from source?
Pocketlang requires only a C99-compatible compiler. You can compile using gcc, clang, or MSVC with commands provided in the repository. A Makefile and a Windows batch script are also available for convenience.
Is there a way to try pocketlang without installing?
Yes, a WebAssembly build of the pocketlang VM is available to run in the browser. Note that some features like file handling and relative imports are disabled in the web version.
What is the syntax of pocketlang like?
Pocketlang uses a Ruby-flavored Python syntax. It supports indentation-based blocks, import statements, functions with 'def' and 'end', and string interpolation with '${}'.