dibyendumajumdar/ravi logo

dibyendumajumdar/ravi

Free

Ravi is a dialect of Lua, featuring limited optional static typing, JIT and AOT compilers

FreeFree tier
Type
Open Source

About dibyendumajumdar/ravi

Ravi is a dialect of Lua that introduces limited optional static typing to improve performance when JIT compilation is enabled. It features a JIT compiler powered by the MIR backend and supports AOT (Ahead-of-Time) compilation to native code. Ravi prioritizes ease of maintenance, language safety, and compatibility with Lua 5.3 over maximum performance, making it a safer alternative to LuaJIT for certain use cases. Key features include optional static typing, type-specific bytecodes, generational garbage collection from Lua 5.4, a defer statement for resource management, a compact JIT backend (MIR), AOT compilation to shared libraries, and a Visual Studio Code debugger extension. Lua programs are valid Ravi programs, allowing gradual adoption of static typing.

Key Features

Optional static typing for gradual performance improvements
JIT compilation using the MIR backend
AOT compilation to native shared libraries
Type-specific bytecodes for efficient execution
Compatibility with Lua 5.3
Generational garbage collector from Lua 5.4
Defer statement for automatic resource release
Compact JIT backend (MIR) for maintainability
Batteries-included distribution
Visual Studio Code debugger extension (interpreted mode)

Pros & Cons

Pros
  • Optional static typing allows gradual performance tuning without breaking existing Lua code
  • JIT and AOT compilation provide multiple paths to improve execution speed
  • Compatible with Lua 5.3, enabling reuse of most Lua libraries and code
  • Generational garbage collector reduces pause times from older GC algorithms
  • Built-in defer statement simplifies resource management (e.g., file handles, sockets)
  • VSCode debugger extension aids in development and debugging
Cons
  • Performance not as high as LuaJIT in many benchmarks
  • Limited optional static typing (not as comprehensive as Typed Lua or TypeScript)
  • Smaller ecosystem and community compared to standard Lua or LuaJIT
  • Static typing features are still evolving and may be incomplete

Best For

Performance-critical scripting where additional speed is needed over standard LuaEmbedded scripting in applications requiring a Lua-compatible languageAOT compilation for standalone executables or shared librariesEducational exploration of static typing in dynamic language runtimes

FAQ

What is Ravi?
Ravi is a dialect of Lua that adds limited optional static typing, a JIT compiler powered by MIR, and support for AOT compilation to native code.
How does Ravi differ from LuaJIT?
Ravi prioritizes ease of maintenance, language safety, and compatibility with Lua 5.3 over maximum performance, whereas LuaJIT focuses on extreme performance at the cost of some compatibility and safety.
Is static typing mandatory in Ravi?
No, static typing is optional. Standard Lua programs are valid Ravi programs, allowing gradual adoption of type annotations.
Which version of Lua is Ravi compatible with?
Ravi aims to be compatible with Lua 5.3, as noted in the documentation.
Does Ravi support debugging?
Yes, Ravi includes a Visual Studio Code debugger extension for interpreted mode debugging.