https://github.com/l-applin/livm
The small but powerfull Virtual machince!
https://github.com/l-applin/livm
Last synced: 3 months ago
JSON representation
The small but powerfull Virtual machince!
- Host: GitHub
- URL: https://github.com/l-applin/livm
- Owner: L-Applin
- License: mit
- Created: 2022-10-09T22:03:01.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-24T14:54:39.000Z (over 2 years ago)
- Last Synced: 2025-03-22T14:32:00.647Z (10 months ago)
- Language: Java
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LIVM
The small but powerfull Virtual machince.
LIVM stands for `LISP Virtual Machine`, as this VM is first intended to interpret a LISP langage.
**DISCLAMER** This is a project for fun, don't expect anything from it.
ASM examples can be found in the `src/test/resources` folder.
### Quickstart
```bash
make
make run-native
```
This will create the `livm` native executable (see [dependencies](#Dependecies) section) and run the
[loop.lasm](src/test/resources/loop.lasm) file. This show that the VM can execute the assembly langage.
```bash
make lasm-to-li
make run-li
```
This will compile the [loop.lasm](src/test/resources/loop.lasm) to `src/test/resources/loop.li` file and execute it.
This shows that the VM can execute binary `li` bytecode file.
## Components
### `./livm`
The Virtual machine. It can ecexute `li` bytecode.
### `./lasm`
Assembly langage in a 'human-readable' format. Can be interpreted or compile to li by the virtual machine.
File extension: `*.lasm`
### `./dilasm`
Disassembler
### `*.li` files
Bytecode representation of a programm for the livm. Can be executed by the virtual machine.
## Build
```bash
mvn clean package
```
Will build an executable jar.
Or using make:
```bash
make target/livm-0.0-SNAPSHOT.jar
```
### dilasm
## Run
```
java -jar target/livm-0.0-SNAPSHOT.jar --asm -f src/test/resources/loop.lasm
```
Will compile to a jar file and run it.
Or using make:
```bash
make run-asm [file=FILENAME]
```
## Native images
`livm` `lasm` and `dilasm` native executable can be compiled maven profiles:
```
mvn clean package -P livm
mvn clean package -P lasm
mvn clean package -P dilasm
```
Will compile to a native image (quite slow).
Or using make:
```bash
make livm
```
You can then run the `livm` executable
```bash
./livm --help
```
## dilasm
## build
```bash
make dilasm
```
## usage
first compile from lasm to li, then back from li top lasm
```bash
./livm --asm -f src/test/resources/loop.lasm -o src/test/resources/loop.li
./dilasm src/test/resources/loop.li
```
## Dependecies
- Java 17
- Graalvm 22.2.0 (native-image)
The easiest way to get all dependecies required is to install GraalVM 22.2.0 JDK using [sdkman](https://sdkman.io/):
```
sdk install java 22.2.r17-grl
```
**Make sure your `CLASSPATH` environment variable does not contains any `.`character**