An implementation of a Bytecode Virtual Machine The VM is a high-performance interpreter for a custom language, capable of executing bytecode instructions efficiently.
- Custom Bytecode: Implements a well-defined set of bytecode instructions to represent program logic compactly.
- Stack-Based Execution: Uses a stack-based model for evaluating expressions and executing operations.
- Dynamic Typing: Supports operations on dynamically typed values like numbers, strings, and booleans.
- Control Flow: Includes bytecode instructions for
ifstatements, loops, and function calls. - Function Support: Supports user-defined functions with local variables and a call stack.
- Error Handling: Implements robust error detection for runtime issues such as stack overflow, invalid instructions, and type errors.
> print "Hello, World!";
Hello, World!
> print 2 + 3 * (4 - 1);
11- C compiler (e.g.,
gccorclang) - Make (optional, for build automation)
- Clone the repository:
git clone https://github.com/abatef/plang.git cd plang - Build the project:
cmake CMakeLists.txt make
- Run the interpreter:
./plang
This implementation is a work in progress. It does not include garbage collection or advanced optimizations for memory management.
Contributions are welcome! Feel free to open issues or submit pull requests for new features or improvements.
This project is licensed under the MIT License. See the LICENSE file for details.