Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ZaneDubya/LoxScript
A bytecode compiler and virtual machine for the Lox language, in C#. Includes a C# / Lox object interface generator and bytecode serialization.
https://github.com/ZaneDubya/LoxScript
bytecode compiler lox lox-language virtual-machine
Last synced: 3 months ago
JSON representation
A bytecode compiler and virtual machine for the Lox language, in C#. Includes a C# / Lox object interface generator and bytecode serialization.
- Host: GitHub
- URL: https://github.com/ZaneDubya/LoxScript
- Owner: ZaneDubya
- License: mit
- Created: 2020-04-20T21:54:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-14T16:57:15.000Z (about 1 year ago)
- Last Synced: 2024-08-02T05:13:20.138Z (6 months ago)
- Topics: bytecode, compiler, lox, lox-language, virtual-machine
- Language: C#
- Homepage:
- Size: 401 KB
- Stars: 17
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LoxScript
LoxScript is a bytecode compiler and virtual machine ("Gears") for Bob Nystrom's [Lox language](http://craftinginterpreters.com/the-lox-language.html), both written in C#.
The LoxScript bytecode virtual machine is called [Gears](https://github.com/ZaneDubya/LoxScript/tree/master/XptScriptLib/Core/Scripting/LoxScript/VirtualMachine). Gears executes bytecode created by the LoxScript compiler. The output of Gears matches the reference "clox" virtual machine described in Chapters 14-30 of Bob's book [Crafting Interpreters](http://craftinginterpreters.com). However, the internal implementation of the virtual machine is different, and the bytecode generated by the Gears compiler will not run on clox.
Improvements over Lox/clox:
- Compiler can write bytecode to a binary file and load/run this at runtime.
- Native interfaces allow Lox files to interact with native C# functions and objects.
- Support for switch statement! This only took hours, and the code is horrifying.Performance:
- Gears runs the reference 'fibonnaci' benchmark roughly 69x slower than native c# code.