Expand description
§jzero
A compiler and bytecode VM for Jzero — a small subset of Java.
Jzero supports classes, methods, control flow, basic types (int, double,
boolean, String), arrays, string concatenation, and System.out.println.
§Quick start
use jzero::Compiler;
let output = Compiler::new()
.source("public class hello {
public static void main(String argv[]) {
System.out.println(\"hello, jzero!\");
}
}")
.run(&[])
.unwrap();
assert_eq!(output.stdout, "hello, jzero!\n");§Pipeline
source code
→ parse_tree() [jzero-parser]
→ analyze() [jzero-semantic]
→ generate() [jzero-codegen] → TAC IR
→ compile_bytecode() [jzero-codegen] → .j0 binary
→ run() [jzero-vm] → stdoutStructs§
- Bytecode
Output - Result of the bytecode compilation step.
- Codegen
Context - All codegen state that lives outside the AST and symbol table.
- Compile
Output - The result of compiling to bytecode without executing.
- Compiler
- The Jzero compiler.
- Jzero
Error - A Jzero compilation or runtime error.
- RunOutput
- The result of a full compile + execute run.
- Semantic
Result - The result of semantic analysis.