GithubHelp home page GithubHelp logo

livm's Introduction

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

livm's People

Contributors

l-applin avatar

Watchers

 avatar

livm's Issues

Native function call

Function call

Have an intrinsic operation (?) to call fucntions in bytecode.

  • Passing arguments
  • return value
  • function location (ptr)
  • return to caller location

Disassembler for the VM

Disassembler

We need a disassembler to convert *.li files back to *.lasm. Will help debugging and move forward with the project.

Usage

dilasm [INPUT FILE] prints to stdout the assembly.
dilasm [INPUT FILE] -o [OUTPUT FILE] creates a new assembly file.
other options?

Memory allocation

Memory

How to allocate memory and access it? We could use an intrinsic operations memory to alloc and mem to reference.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.