>_JAVARS REFERENCE
A Java frontend written in Rust. Source is lexed and parsed to an AST, lowered to fusevm bytecode, and executed on the same language-agnostic VM + three-tier Cranelift JIT that hosts zshrs, stryke, awkrs, elisp, and rubylang. No bespoke VM, no JVM, no .class files. In active development.
What it is
javars runs Java programs as ordinary compiled bytecode: it lexes and parses the source, lowers it to fusevm instructions, and lets the shared engine execute and JIT-compile them. There is no bespoke VM or tree-walker — arithmetic and comparisons lower to native fusevm ops so the Cranelift JIT can trace hot loops, while Java-specific behaviour (the String + overload, Java-flavoured value formatting where a whole double prints as 3.0) is served by the host numeric hook and print builtins.
It is another language hosted on fusevm, the shared bytecode VM and Cranelift JIT behind zshrs (the shell), stryke (the language), awkrs (AWK), elisp (Emacs Lisp), and rubylang (Ruby). javars carries no VM or JIT of its own — the JVM runs Java on the JVM; javars runs Java on fusevm.
Architecture
The pipeline mirrors how zshrs hosts zsh and rubylang hosts Ruby:
Java source → lexer → parser (AST) → lower to fusevm bytecode → fusevm VM + Cranelift JIT
│
host: String + concat, Java value formatting, print builtins
fusevm-hosted
No local vm.rs / jit.rs. Java is lowered to fusevm bytecode and executed on the shared three-tier Cranelift JIT; jit-disk-cache persists compiled native code across runs.
No JVM, no .class
javars never emits .class files and never links a JVM. It is a source-in, run-out frontend: the compiled chunk runs directly on fusevm.
Native fast paths
Integer and floating arithmetic and comparisons lower to native fusevm ops, so the tracing JIT can compile hot for / while loops; only the mixed-operand String + takes the host hook.
Editor tooling
A read-only LSP (--lsp) supplies completion, hover, and parser-driven diagnostics; a DAP debugger (--dap) provides breakpoints, stepping, and local inspection over the running program.
Example
public class Demo {
public static void main(String[] args) {
int total = 0;
for (int i = 1; i <= 4; i++) {
total += i;
}
System.out.println(total); // => 10
String label = "sum = " + total;
System.out.println(label); // => sum = 10
double half = 3.0;
System.out.println(half); // => 3.0 (Java double formatting)
boolean ok = total > 0 && half < 5;
System.out.println(ok); // => true
}
}
Status & roadmap
The table below reflects the current state of the tree. See BUGS.md for the honest ledger of what is not yet carried.
| Component | State | Notes |
|---|---|---|
| Lexer / parser → AST | Implemented | Hand-written tokenizer + recursive-descent parser with precedence climbing (src/lexer.rs, src/parser.rs). |
| AST → fusevm bytecode lowering | Implemented | No local VM; native arithmetic + CallBuiltin print dispatch, backpatched control flow (src/compiler.rs). |
Entry class + main body | Implemented | Multiple top-level and nested classes; the class declaring public static void main is the entry. |
| Locals, assignment, compound assignment | Implemented | int x = e;, x += e;, post-inc/dec; several declarators per statement (int a = 1, b = 2;, int p[] = {1}, q;); the declared type drives /-truncation and the 32-bit int wrap. |
Control flow (if/while/for, break/continue) | Implemented | C-style for, short-circuiting &&/||, loop backpatching. |
String + concat & Java value formatting | Implemented | Host numeric hook concatenates on a String operand; true/false, 3.0, null (src/host.rs). |
Console IO (System.out.print/println) | Implemented | Lowered to Java-formatting print builtins. |
LSP server (--lsp) | Implemented | Completion + hover from the keyword/type/IO corpus, parser-driven diagnostics (src/lsp.rs). |
DAP debugger (--dap) | Implemented | Line breakpoints, stepping, stack trace, and main-locals inspection via debug line markers (src/dap.rs). |
Dumps (--dump-tokens/--dump-ast/--disasm) | Implemented | Print an artifact and exit (src/main.rs). |
| User methods, classes, fields, objects | Implemented | static and instance methods on the Op::Call frame ABI, constructors, inheritance, interfaces, overloading, virtual dispatch, and reference arrays on a host object heap (src/host.rs). static fields (with static { } blocks), record types, and abstract classes run too. |
| Exceptions | Implemented | throw, try/catch/finally, try-with-resources, the modeled java.lang throwable hierarchy, and javars's own runtime faults (bad index, parseInt, / 0, null receiver) raised as catchable exceptions with Java's detail messages. |
| Standard library, generics | Planned | Type-erased generics, record/enum types, lambdas and method references, and the java.util collections (with Java’s real HashMap iteration order) run today; streams and the functional-interface default methods are pending (see BUGS.md). |
Inline rust { } FFI | Implemented | A rust { } block compiles to a cached cdylib whose exports are callable by name (src/rust_ffi.rs). |
Why javars
Compiled, not walked
Every prior Java runtime targets the JVM; javars lowers Java to fusevm bytecode and JITs hot paths through Cranelift — the same architecture that makes zshrs and stryke fast.
No JVM dependency
No .class files, no classpath, no JVM install: a single java binary lexes, parses, lowers, and runs.
One shared engine
Bug fixes and JIT improvements in fusevm benefit zshrs, stryke, awkrs, elisp, rubylang, and javars at once.
Editor-ready
LSP and DAP ship in the same binary, so completion, diagnostics, and a stepping debugger work from any editor that speaks the protocols.
Building from source
javars builds as a standalone Rust crate (it is not a workspace member of the meta repo):
# clone git clone https://github.com/MenkeTechnologies/javars cd javars # build (produces target/debug/java) cargo build # run a program, or inspect the pipeline ./target/debug/java Hello.java ./target/debug/java --disasm Fib.java ./target/debug/java --dump-ast FizzBuzz.java # editor tooling over stdio ./target/debug/java --lsp ./target/debug/java --dap # run tests cargo test
fusevm is pulled from crates.io with the jit, jit-disk-cache, and aot features.
License
javars is MIT licensed — free and open source. See LICENSE.
Repository & links
- Engineering report — report.html (architecture, fusevm hosting, roadmap, dependency posture)
- Language reference — reference.html (keywords, declaration types, console IO)
- Source — github.com/MenkeTechnologies/javars
- Issues — github.com/MenkeTechnologies/javars/issues
- The shared VM — fusevm (also behind
zshrs,stryke,awkrs,elisp,rubylang)