L-Applin/livm

The small but powerfull Virtual machince!

★ 0Forks 0JavaGitHub ↗Compare

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

make
make run-native

This will create the livm native executable (see dependencies section) and run the loop.lasm file. This show that the VM can execute the assembly langage.

make lasm-to-li
make run-li

This will compile the 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

mvn clean package

Will build an executable jar.

Or using make:

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:

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:

make livm

You can then run the livm executable

./livm --help

dilasm

build

make dilasm

usage

first compile from lasm to li, then back from li top lasm

./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:

sdk install java 22.2.r17-grl

Make sure your CLASSPATH environment variable does not contains any .character

Contributors

L-Applin

Issues

CI/CD

#4 · open · 0 comments