Nasal 语言解释器

Nasal 语言解释器 | Nasal Language Modern Interpreter

Nasal是一款语法与ECMAscript相似的编程语言,并作为运行脚本被著名开源飞行模拟器 FlightGear 所使用。 该语言的设计者为 Andy Ross。 该解释器项目由 ValKmjolnir完全使用 C++ (-std=c++17)重新实现,没有复用 Andy Ross的nasal解释器 中的任何一行代码。 尽管没有参考任何代码,我们依然非常感谢Andy为我们带来了这样一个神奇且简洁的编程语言。 该项目使用 MIT 协议开源 (2019/7 ~ 2021/5/4 ~ 2023/5),从 2023/6 开始使用 GPL v2 协议。

2019年暑假,FGPRC的成员告诉我,在FlightGear中提供的Nasal控制台窗口中进行调试很不方便,仅仅是想检查语法错误,也得花时间打开软件等待加载进去后进行调试。 所以我就写了一个全新的解释器来帮助他们检查语法错误,甚至是检查运行时的错误。 我编写了nasal的词法分析器和语法分析器,以及一个全新的字节码虚拟机,并用这个运行时来进行nasal程序的调试。我们发现使用这个解释器来检测语法和运行时错误提高了我们的工作效率。 你也可以使用这个语言来写一些与Flightgear运行环境无关的有趣的程序,并用这个解释器来执行。你也可以让解释器来调用你自己编写的模块,使它成为项目中一个非常有用的工具。

Nasal is an ECMAscript-like programming language that used in FlightGear. The interpreter is totally rewritten by ValKmjolnir using C++ (-std=c++17) without reusing the code in Andy Ross's nasal interpreter. But we really appreciate that Andy created this amazing programming language. This project uses MIT license (2019/7 ~ 2021/5/4 ~ 2023/5), GPL v2 license (since 2023/6).

In 2019 summer holiday, members in FGPRC told me that it is hard to debug with nasal-console in Flightgear, especially when checking syntax errors. So i wrote a new interpreter to help them checking syntax error and even, runtime error. I wrote the lexer, parser and bytecode virtual machine to help checking errors. We found it much easier to check syntax and runtime errors. You could also use this language to write some interesting programs and run them without the lib of Flightgear. You could add your own modules to make the interpreter a useful tool in your own projects.