https://github.com/logsem/cerise-interpreter
https://github.com/logsem/cerise-interpreter
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/logsem/cerise-interpreter
- Owner: logsem
- License: other
- Created: 2023-03-15T15:14:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-05-27T12:15:13.000Z (about 1 year ago)
- Last Synced: 2025-07-25T07:56:23.173Z (11 months ago)
- Language: OCaml
- Size: 625 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cerise interpreter
This repository contains an interpreter of [Cerise](https://github.com/logsem/cerise), a model of a capability machine.
## Build the interpreter
Dependencies: opam
```
git clone https://github.com/logsem/cerise-interpreter.git
cd cerise-interpreter
opam switch create -y --repositories=default . ocaml-base-compiler.4.14.0
eval $(opam env --set-switch)
make
```
Finally, the command `make install` creates a symbolic link to the interpreter in this repository.
## Usage
Executable: `./interpreter `
Assembly examples in `./tests/test_files` (for the syntax)
The default version of the interpreter uses a version of Cerise with seals, uninitialized and directed capabilities.
For a version of Cerise without those features, use `./interpreter --version vanilla`.
Example:
```
./interpreter -I --version vanilla --regfile ./tests/test_files/vanilla/pos/cap_machine_lecture_exercise.reg ./tests/test_files/vanilla/pos/cap_machine_lecture_exercise.s
```
For more information about the options, `./interpreter --help`.
## Interactive interpreter
For an interactive version of the interpreter: `./interpreter -I `
| Binding | Effect |
|-------------------------|----------------------------------|
| `ESC` or `q` | exit |
| `SPACE` | next step |
| `n` | next 10 steps |
| `BACKSPACE` | cancel the last step(s) |
| `Arrow Up` | navigate up memory (1 address) |
| `Arrow Down` | navigate down memory (1 address) |
| `Arrow Left` | navigate up memory (1 page) |
| `Arrow Right` | navigate down memory (1 page) |
| `Arrow Left` + `SHIFT` | navigate up memory (10 pages) |
| `Arrow Right` + `SHIFT` | navigate down memory (10 pages) |
| `TAB` | follow the cursor of PC |
| `TAB` + `SHIFT` | follow the cursor of STK |
The `Arrow` keybindings can be combined with `CTLR` for navigating in the stack.
It is possible to scroll for navigating through the memory and the stack (depending on the position of cursor of the mouse). Combine mouse scroll + `CTLR` for navigating faster.