Giter VIP home page Giter VIP logo

zubbers's Introduction

Zub VM

A super-fast, stack-based virtual machine for dynamic languages

Features

  • NaN-tagging value representation
  • Mark n' sweep garbage collection
  • Compact bytecode format
  • Easy-to-use intermediate representation

Milestones

  • Refined VM based on work by Mr Briones
  • Tracing garbage collector
  • High-level IR
  • Compilation of IR
  • Optimizer (currently 80-90% Python speed, aiming for much faster)
  • Profiler and disassembler

Example

Building IR is easy

Getting your backend up and running shouldn't have to be hard.

The following code builds IR for evaluating sum = 20.0 + 30.0:

let mut builder = IrBuilder::new();

let a = builder.number(20.0);
let b = builder.number(30.0);

let sum = builder.binary(a, BinaryOp::Add, b);

builder.bind(Binding::global("sum"), sum);

When you feel like the IR is looking smooth. Simply let VM throw it through the compiler, and run it.

let mut vm = VM::new();
vm.exec(&builder.build());

Languages

Hugorm

Hugorm is a dynamic, python-like language being built for small data science and game projects.

https://github.com/nilq/hugorm

Examples

The examples/ folder includes two small language implementations running on the ZubVM.

Atto

Atto is a functional, minimal language that showcases how little code is needed to implement a working, Turing-complete language. The syntax can be seen in the following teaser:

fn sum x is
    if = x 0
        1
    + sum - x 1 sum - x 1

fn main is
    sum 12

Mini

Mini is a simple language that looks basically like a mix of Rust and JavaScript. It covers a bit wider set of features than Atto. This does show in the size of the language though.

let bar = 13.37;

fn foo() {
  fn baz(c) {
    return c + bar;
  }
  
  return baz(10);
}

global gangster = foo();

Special thanks

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.