- Rust: system programming language developed by Mozilla Research to insures the safety of memory access at compile without the need of a gc using variable borrowing/ownership analyses at compile time. More: Website, Wikipedia, Book.
- LLVM: a collection of modular compiler technologies (source- and target-independent optimizer and code generator for many CPUs) and toolchain technologies (debugger, linker, runtime, standard library, ...). It's also known for its IR. More: Website, LLVM IR.
- MIR: Rust mid-level intermediate representation. Used for type-checking before transition to LLVM IR. More: RFC.
REPL is very useful for learning and experimenting with Rust, for Data Mining and Scientific Analyses. An example of a successful REPL for a compiled-language is cling which is C++ REPL and a subproject of CERN' ROOT project. It's based on Clang/LLVM compiler.
- importing external rust file code.
- Functions, Structs, Trails, Impls, Modules, Macros definition support.
extern crate
support (download and install missing crates) without closing session.- No out-of-memory errors on long running session.
- explicit memory drop keyword for given var.
- Bash/Zsh-like history support
- Reuse Rust compiler code instead of starting from the scratch.
- Add a flag/procedural macro to disable RAII (dropping var at the end of scope) of main block.
- Save MIR semantic and borrowing/ownership information.
- Save unexpanded MIR Macros definitions.
- JIT-ing using LLVM using Symbolic table for previous items address.
- Rust is a compiled and strong-typed language. We need to add JIT support using LLVM implementation which needs fixing by itself.
- Rust is gc-free language. We need to drop Non-referenced Shadowed vars especially on long running session with Big Data Analyse. One solution is to add new Optimization Pass to automatically drop unused memory. Discussion.
- Rust uses RAII model to automatically drop vars on the end of scope. REPL should not add drop code to each executed input on the main (outer) block.
- Sandbox REPL-ed code.
- Rust developers may add a new experimental backend to the compiler to ensure that Rust is LLVM-independent language. Upstreaming (?) the REPL implementation may require LLVM-independent code too (using just MIR?).
There was many unsuccessful attempts to develop a REPL for Rust. The most known one is Rusti which is broken since build 2016-08-01 when Rust compiler dropped LLVM ExecuteEngine support. Rusti had many design limitations:
- Recompile all attributes and functions definitions on every input. See
repl.rs
. - Declared vars not available on next input.
An other interesting project is Miri which is an interpreter for MIR
(Rust mid-level IR). We could target Miri instead of LLVM JIT. It
uses its own limited backend implementation and it's mainly designed for
compile-time constant-expressions evaluation (like C++11 constexpr
).
Extra features to implement on the next 3 months for school project.
- Auto-Completion support
- Code Coloring
rustdoc
integration- Jupyter Kernel
Extra features that may not be related to REPL but may be useful for a wider use of Rust as REPL/interpreted language. Hopefully to be developed under a summer internship program (GSoC, Mozilla Internship,...)
- Debugger integration.
- Numpy uFuncs support (or integration of an other Numerical framework).
- Ruby-like Open Class support to change Class (Struct) methods on-the-fly.
- RFC: Implement a proper REPL
- Issue: Implement a proper REPL
- Issue: Implement a Rust REPL
- Pull Request: Upgrade LLVM
- Rust Forge
Papers that have had more or less influence on Rust, or which one might want to consult for inspiration or to understand Rust's background.
- Region based memory management in Cyclone
- Safe manual memory management in Cyclone
- Typeclasses: making ad-hoc polymorphism less ad hoc
- Macros that work together
- Traits: composable units of behavior
- Alias burying - We tried something similar and abandoned it.
- External uniqueness is unique enough
- Uniqueness and Reference Immutability for Safe Parallelism
- Region Based Memory Management
- Singularity: rethinking the software stack
- Language support for fast and reliable message passing in singularity OS
- Scheduling multithreaded computations by work stealing
- Thread scheduling for multiprogramming multiprocessors
- The data locality of work stealing
- Dynamic circular work stealing deque - The Chase/Lev deque
- Work-first and help-first scheduling policies for async-finish task parallelism - More general than fully-strict work stealing
- A Java fork/join calamity - critique of Java's fork/join library, particularly its application of work stealing to non-strict computation
- Scheduling techniques for concurrent systems
- Contention aware scheduling
- Balanced work stealing for time-sharing multicores
- Three layer cake
- Non-blocking steal-half work queues
- Reagents: expressing and composing fine-grained concurrency
- Algorithms for scalable synchronization of shared-memory multiprocessors
- Crash-only software
- Composing High-Performance Memory Allocators
- Reconsidering Custom Memory Allocation
- GPU programming in Rust
- Parallel closures: a new twist on an old idea - not exactly about rust, but by nmatsakis
- Patina: A Formalization of the Rust Programming Language