RuScript
RuScript copied to clipboard
Experimental Language based on Rust and Haskell
RuScript
Build
Tool-chain dependencies: Rust (nightly), Haskell (8.01)
git submodule updateto fetchrust-gcdev sourcerunghc Test.hsto run unit tests
To build the rvm and rusc separately:
rvm:cd rvm; cargo buildrusc:cd rusc; stack build
Features
- Safe runtime written in Rust with garbage collection
- Lightweight stack-based bytecode
- High-level object-oriented language
- Static checking module
Design
Please refer to spec
TODOs
.rusiInterface parser- Note #1: Whether or not to attach a
selfto each method signature - Note #2: Separate compilation and selective exports require more engineering, of which I have little experience in
- Note #1: Whether or not to attach a
- Concurrent primitives
- Note #1: We need to construct runners inside the interpreters, and every runner is contained in a thread and responsible for a user-thread
- Note #2: To share the data between threads, we need a concurrent GC system, which we don't really have now.
- Formal Specification Revision based on Coq
Performance Issue
The current performance revealed by benchmarking the sum.rus is very poor, taking as much as 100 times longer than a naïve Python implementation.
Currently, the source of latency can be contributed to three aspects:
- GC
- Interpreter
- Compiler
Actually, by increasing the instruction set, we can eliminate many "stupid" instruction sequence, such as POP then PUSH, which is equivalent to a write stack-top to local var without popping out.