TinyLC is an experimental Lua-like DSL implemented in C++, designed for minimal overhead and optimization-friendly execution. It aims to combine a simple Lua-like language with direct C++ integration, without relying on FFI.
- Simple and minimal
- As close to Lua as possible
- Nearly as flexible as Lua
- Avoid C++ RTTI complexity where possible
- Keep runtime structures simple and low-level
- Minimal overhead
- Near-native performance
- No Virtual Machine loop
- A simpler runtime design intended to remain optimization-friendly
- No traditional stack-based Virtual Machine
- No debug library support, due to the lack of a traditional VM and VM stack
- Less flexible syntax ( C++ limits )
- No support for external libraries built around the Lua C API
- Native coroutine library ( Standard C++ Coroutines )
- Support for mixing C++ with the Lua-like DSL
- Lightweight
- currently a solo-developed project and remains under active development
- No function support
- No library support
- No standard library
- Some behavior is still unstable
- Compiler portability is currently limited ( the project currently builds with GCC and Clang )
The design uses a Tagged Union for its Values because it is more CPU-friendly and avoids C++ heavy Polymorphism
Strings are Interned, meaning each unique string is stored only once in memory. The runtime computes the string hash first, then performs a lookup in a global hash map:
- If found, return a pointer to the existing string
- If not, allocate a new memory Because interned strings can be compared by pointer, equality checks avoid repeated full string comparisons. This also improves the efficiency of string-keyed table lookups.
The garbage collector currently uses a mark-and-sweep design with an epoch-based marking optimization.
TinyLC is licensed under the Apache License 2.0.
You are free to use, modify, and distribute this project under the terms of the license. See the LICENSE file for the full text.