Rust library for compiling and running other programs.

Overview

Exers πŸ’»

Exers is a rust library for compiling and running code in different languages and runtimes.

Usage example

fn main() {
    // Imports...

    let code = r#"
    fn main() {
        println!("Hello World!");
    }
    "#;

    let compiled_code = RustCompiler.compile(&mut code.as_bytes(), Default::default());
    let result = WasmRuntime.run(&compiled_code, Default::default()).unwrap();
}

Supported languages πŸ“š

Language Supported Runtimes Required Dependencies
Rust Wasm, Native Rustc
C++ Wasm, Native clang++, wasi sdk (wasm)
Python Native python3, Cython (optional)
JavaScript Wasm (read docs), Native node js, javy (wasm)
C# None ---
Go None ---

Jailed runtime is not listed, because it supports all languages that support the Native runtime. (In theory)

Available runtimes πŸƒβ€β™‚οΈ

Runtime Status
WASM Implemented
Native Implemented
Jailed Implemented (Requires more testing)
Firecracker Not started
Docker/Podman Not started

Contributing 🀝

If you want to contribute to this project, please keep my code style and formatting. I use rustfmt to format my code. Please also make sure that your code compiles and that all tests pass. If you want to add a new language or runtime, remember to write tests and comment your code well.

Commits should follow the Conventional Commits specification.

Requirements πŸ“‹

WASM

If you want to use the WASM runtime, you need to install the wasm32-wasi target for rustc. You can do this by running rustup target add wasm32-wasi.

For C++ you need to install wasi-sdk or other WASI sdk/libc and specify WASI_SDK environment variable to point to the sdk.

Native

Native runtime just requires dependencies for the language you want to use.

Additional features ✨

wasm-llvm

This feature allows you to use the LLVM backend for the WASM runtime. LLVM offers better performance, but has longer compilation times.

cython

This feature allows you to use Cython for the Python runtime. This makes code execution faster, but requires Cython to be installed.

Bundled πŸ“¦ (planned)

contains all the dependencies for all the languages and runtimes, so you don't have to install them yourself. This may be useful for some use cases, but it will make the library much larger (probably over 1GB).

Examples πŸ“„

Examples can be found in the examples directory. To run them, you need to install the required dependencies for the languages you want to use. You can then run the examples with cargo run --example <example_name>.

Dockerfile 🐳

This project contains a Dockerfile that can be used to build a docker image with all the required dependencies for all the languages and runtimes. This image can be used to base your own images on πŸ˜„ . I'm currently working on minimizing the size of the image (currently about 2GB) and allowing you to choose which languages and runtimes you want to include.

Warning: I've not tested the image yet, so it might not work for some languages and runtimes.

You might also like...
A mobile application platform for tertiary students to communicate, collaborate and share ideas with each other

Qreeket (pronounced "cricket") A mobile application platform for tertiary students to communicate, collaborate and share ideas with each other. As the

Complete code for the larger example programs from the book.

Code Examples for Programming Rust This repository contains complete code for the larger example programs from the book β€œProgramming Rust”, by Jim Bla

Write Anchor-compatible Solana programs in Python

seahorse: Write Solana programs in Python The ease of Python with the safety of Rust. Seahorse lets you write Solana programs in Python. It is a commu

Gain intuition about the goings-on of your multithreaded/multicomponent programs
Gain intuition about the goings-on of your multithreaded/multicomponent programs

Intuition: a super simple profiler with a terminal ui based on tui-rs. Gain intuition about the goings-on of your multithreaded/multicomponent program

Crabzilla provides a simple interface for running JavaScript modules alongside Rust code.

Crabzilla Crabzilla provides a simple interface for running JavaScript modules alongside Rust code. Example use crabzilla::*; use std::io::stdin; #[i

The ultimate Data Engineering Chadstack. Apache Airflow running Rust. Bring it.

RustOnApacheAirflow The ultimate Data Engineering Chadstack. Apache Airflow running Rust. Bring it. This is part of a larger blog post trying to do so

πŸ‘Œ A smol functional language that targets other languages

ditto A small, pure functional language that targets other languages. Syntax highlighting coming soon Elevator pitch ⏱️ Ditto is a mashup of my favour

An inquiry into nondogmatic software development. An experiment showing double performance of the code running on JVM comparing to equivalent native C code.
An inquiry into nondogmatic software development. An experiment showing double performance of the code running on JVM comparing to equivalent native C code.

java-2-times-faster-than-c An experiment showing double performance of the code running on JVM comparing to equivalent native C code ⚠️ The title of t

Operating system based off of blog_os, with the goal of running wasm modules as executables

yavkOS - A OS that attempts at running WASM modules as userspace programs Recommended Development Environment You need nix with the flakes, and nix-co

Owner
olix3001
olix3001
Rust library for scheduling, managing resources, and running DAGs πŸŒ™

?? moongraph ?? moongraph is a Rust library for scheduling, managing resources, and running directed acyclic graphs. In moongraph, graph nodes are nor

Schell Carl Scivally 3 May 1, 2023
rust channel benchmarks to keep stat of performance of Kanal library in comparison with other competitors.

Rust Channel Benchmarks This is a highly modified fork of the crossbeam-channel benchmarks. to keep track of Kanal library stats in comparison with ot

Khashayar Fereidani 14 Dec 21, 2022
Visualization for Timely Dataflow and Differential Dataflow programs

DDShow Visualization for Timely Dataflow and Differential Dataflow programs Getting started with ddshow First, install ddshow via cargo. As of now dds

Chase Wilson 61 Nov 25, 2022
πŸ•Ά Assorted checks and validations for writing safer Solana programs.

vipers ?? Assorted checks and validations for writing safer Solana programs. Motivation Solana's fee mechanism is unlike Ethereum's, in that the numbe

Saber 131 Sep 14, 2022
Rust programs written entirely in Rust

mustang Programs written entirely in Rust Mustang is a system for building programs built entirely in Rust, meaning they do not depend on any part of

Dan Gohman 561 Dec 26, 2022
A additional Rust compiler pass to detect memory safe bugs of Rust programs.

SafeDrop A additional Rust compiler pass to detect memory safe bugs of Rust programs. SafeDrop performs path-sensitive and field-sensitive inter-proce

Artisan-Lab  (Fn*) 5 Nov 25, 2022
A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments.

Zerokit A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments. Initial scope Focus on RLN

vac 44 Dec 27, 2022
Small programs written in Rust. Warm up for the upcoming Selenium Manager

Rust Examples This repository contains several example programs written in Rust. Selenium Manager These examples are used as warm up for the upcoming

Boni GarcΓ­a 5 Dec 30, 2022
Compile-time stuff and other goodies for rustaceans πŸ¦€

?? bagel: Always baked, never fried bagel is a collection of macros and other things that we frequently use at Skytable, primarily to get work done at

Skytable 3 Jul 4, 2022
Algebraic structures, higher-kinded types and other category theory bad ideas

Algar Algebric structures, higher-kinded types and other category theory bad ideas. Yes, you'll have generalized functors, applicatives, monads, trave

Stefano Candori 3 Jan 31, 2023