github.com/ValKmjolnir/Nasal-Interpreter

Modern efficient runtime for Nasal: using stack-based direct-threading virtual machine.

Open this visualization on its own page →

Contributors

4

Lines of Code

2,964

From

2019-07-24

To

2022-04-17

About ValKmjolnir/Nasal-Interpreter

Nasal is an ECMAScript-like scripting language developed for FlightGear, a flight simulation platform. This project is a modern C++ rewrite of the original Nasal interpreter, built as a stack-based, direct-threading virtual machine with a bytecode compiler. Originally created to help developers debug Nasal code more effectively within the FlightGear Project community in Russia, the interpreter has evolved into a standalone tool that allows Nasal programs to run independently of FlightGear.

The interpreter features a complete toolchain including a lexer, parser, and bytecode virtual machine, along with several developer-friendly features. It includes a command-line debugger for inspecting stack state and program execution, a REPL for interactive code exploration, and comprehensive error reporting with stack traces. The project also provides a web-based interface with a code editor and interactive REPL for trying Nasal code directly in a browser. Notable implementation details include stricter syntax rules than the original interpreter, requiring explicit variable declarations with the var keyword to improve code clarity and error detection.

Built with no external dependencies and compiling from standard C++17, the project supports Windows, macOS, and Linux platforms through various toolchains including MinGW, MSVC, and GCC. The codebase includes extensive benchmarking documentation and development history, with regular nightly builds available for users. The project transitioned from MIT to GPLv2 licensing in 2023 and welcomes community contributions and ideas.

Share this video