A modern, feature-rich scripting language interpreter written in C.
RezoScript is a dynamically-typed scripting language with a focus on simplicity, performance, and extensibility. It supports object-oriented programming, multithreading, networking, and integration with external C libraries.
- π Fast Execution - Efficient interpreter implementation
- π§Ή Garbage Collection - Automatic and manual memory management
- π§΅ Multithreading - Native thread support with mutexes
- π Networking - TCP and HTTP client/server capabilities
- π¦ External Libraries - Load and use C libraries via
uselib - π― OOP Support - Classes, objects, methods, and inheritance
- π Modules - Modular code organization with
usestatements - π‘οΈ Exception Handling - Try-catch-finally error handling
- π Rich Data Types - Arrays, structs, hashmaps, and more
- π File Operations - Comprehensive file and directory manipulation
- π¨ F-strings - Python-like string interpolation
make./rezo script.rzsuse std;
fnc greet(name) {
return f"Hello, {name}!";
}
var message = greet("RezoScript");
std.println(message);
Comprehensive documentation is available in the docs/ directory. See docs/README.md for the full index.
Core Language:
- Language Syntax - Core language features and syntax
- Standard Library - Built-in functions and utilities
Data Structures:
- Arrays - Array operations and methods
- Structs - Structure definitions and usage
- Hashmaps - Key-value data structures
Advanced Features:
- Classes & OOP - Object-oriented programming
- Modules - Module system and code organization
- Multithreading - Thread creation and synchronization
- Networking - TCP and HTTP networking
- External Libraries - Loading and using C libraries
- Garbage Collector - Memory management
- Exceptions - Error handling
- File Operations - File and directory manipulation
core/
βββ src/ # Source code
β βββ interpreter.c # Main interpreter
β βββ lexer.c # Lexical analysis
β βββ parser.c # Syntax parsing
β βββ value.c # Value representation
β βββ gc.c # Garbage collector
β βββ stdlib_*.c # Standard library modules
βββ include/ # Header files
βββ tests/ # Test scripts
βββ docs/ # Documentation
var number = 42;
var text = "Hello";
var flag = true;
var empty = null;
fnc add(a, b) {
return a + b;
}
var result = add(5, 3);
if (x > 10) {
std.println("Large");
} else {
std.println("Small");
}
for (var i = 0; i < 10; i = i + 1) {
std.println(i);
}
while (condition) {
// ...
}
var arr = [1, 2, 3];
arr.push(4);
std.println(arr.length); // 4
struct Point {
x, y
}
var p = Point { x = 10, y = 20 };
std.println(p.x, p.y);
class Counter {
var count = 0;
fnc Counter() {
this.count = 0;
}
fnc increment() {
this.count = this.count + 1;
}
}
var c = Counter();
c.increment();
use "math.rzs";
var result = math.sqrt(16);
fnc worker(id) {
std.println("Worker", id);
return id * 10;
}
var t = thread.create(worker, 1);
var result = thread.join(t);
uselib "libs/libraylib.so" as raylib;
raylib.InitWindow(800, 600, "Window");
- GCC or Clang compiler
- Make
- POSIX-compliant system (Linux, macOS, WSL)
- pthread library (for multithreading)
- dl library (for external library loading)
This section documents known issues and limitations in the current version of RezoScript.
- Expression result printing is disabled: The REPL currently does not print the results of expressions due to memory management issues (double-free errors). This is a known limitation that will be addressed in a future release.
- Workaround: Use
std.println()to explicitly print values.
- Workaround: Use
- Double-free protection: Some edge cases in value copying and destruction may cause double-free errors. The garbage collector helps mitigate this, but manual memory management in certain scenarios may still be problematic.
- Limited function signatures: The Foreign Function Interface currently supports a limited set of function signatures:
- Functions with 0 arguments
- Functions with 3 arguments (int, int, const char*)
- More signatures will be added in future versions
- Type system limitations: Automatic type conversion is limited. Complex types and callbacks are not yet supported.
- Library loading: Only
.sofiles are supported on Linux/Unix. Windows.dllsupport may have limitations.
- Mutex type: A dedicated
VALUE_MUTEXtype is planned but not yet implemented. Current mutex implementation uses a workaround.
- Path resolution: Relative paths with
../may have issues in some edge cases, especially on Windows. - Module caching: Modules are not cached between executions, which may impact performance for large projects.
- Incomplete error context: Some error messages may not include full context (variable names, function names) in edge cases, though this has been largely addressed.
- Windows console: UTF-8 and color support require Windows 10+ with virtual terminal processing enabled. Older Windows versions may display characters incorrectly.
- Cross-compilation: Building for Windows from Linux requires MinGW-w64 and may have some limitations.
- Garbage collection: The GC may cause noticeable pauses in performance-critical applications. Consider using manual GC mode for such cases.
- Large arrays: Operations on very large arrays (>100,000 elements) may be slow due to linear search in some operations.
- Exception handling: Exception stack traces may not always be complete.
- Class inheritance: Full inheritance support is planned but not yet fully implemented.
- Operator overloading: Not supported yet.
- Some advanced features may have incomplete documentation. Please refer to the source code or test files for examples.