Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taiki45/hs-vm
Simple Virtual Machine written in Haskell
https://github.com/taiki45/hs-vm
Last synced: 13 days ago
JSON representation
Simple Virtual Machine written in Haskell
- Host: GitHub
- URL: https://github.com/taiki45/hs-vm
- Owner: taiki45
- License: mit
- Created: 2014-03-29T13:58:28.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-05-10T19:22:01.000Z (over 10 years ago)
- Last Synced: 2024-10-03T09:22:49.466Z (about 2 months ago)
- Language: Haskell
- Size: 375 KB
- Stars: 28
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
hs-vm [![Build Status](https://travis-ci.org/taiki45/hs-vm.svg?branch=master)](https://travis-ci.org/taiki45/hs-vm)
=====
Simple Virtual Machine written in Haskell.## About
hs-vm is based on a stack machine architecture.## Status
experiment phase## Usage
To run example just:```
cabal sandbox init
cabal configure --enable-tests
cabal install --enable-tests --only-dependencies
cabal build
./dist/build/hs-vm/hs-vm example/fib.hsvm
```To test it:
```
cabal build && cabal test
```hs-vm's instructions are in `src/VM/Instruction.hs`.
All label setting instructions are executed in preprocess phase.
A valid hs-vm program has `main` function. To set main function, use `Label main`.
To define function, use `Label func_name`. To return to calling point, use `Ret`.
hs-vm stacks Local Data Stack when calls a function.
And when returned from function, hs-vm pops back stacked one.