Skip to content

hiperiondev/stack_vm

Repository files navigation


Logo

Stack VM

Generic Stack VM for Scripting Languages

About The Project

Stack VM is a virtual machine oriented towards scripting languages, especially glue ones, prioritizing low memory consumption and predictability.

It has very useful features for use in microcontrollers such as: Fixed stack size, gc per frame with optional shrink and management of both local variables in the stack and a generic heap.

Functions that are not essential must be implemented through FFI (example: strings) but have the minimum constructs so that the VM can handle them. Also the use of native data types has generic options for use as well as the definition of external functions to be interpreted within the VM.

Features

  • Fully commented code in Doxygen format
  • 6 bits op (easily extendable)
  • An indirection register with automatic increment/decrement
  • Heap with automatic growth and optional shrink. Allocation management by bit mask (simple and fast)
  • Call with frame placement and stack space reservation for local variables
  • Heap management per frame with automatic release at the exit of the frame
  • Generic data objects in HEAP and static attribute (survive to frame GC)
  • Native external data management (via custom function)
  • Libraries for custom data types
  • Simple external functions (FFI)
  • Global variables and arrays allocated in heap
    • Can allocate local arrays
    • Arrays can contain any type of value, including arrays
  • Constants in the program area
  • Complete Assembler/Disassembler with directives easily expandable

Usage

See Documentation

Roadmap

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork it (https://github.com/hiperiondev/stack_vm/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Emiliano Augusto Gonzalez - egonzalez.hiperion@gmail.com

Project Link: https://github.com/hiperiondev/stack_vm