Introduction to Rava2
Rava2 is a complete Java source code interpreter written in C. It parses Java source files and executes them directly via AST interpretation without bytecode compilation.
Key Features
- Direct Execution: Run
.javafiles directly without compilation. - Modern Java Support: Lambdas, streams, records, sealed classes, pattern matching, text blocks.
- Full Threading: Thread class with start, join, sleep, yield support.
- Standard Library: Implementations of java.lang, java.util, java.io, and java.net packages.
- Memory Safe: Built-in overflow protection, automatic cleanup, valgrind-clean.
- Lightweight: Minimal footprint compared to traditional JVMs.
Quick Start
./rava2 HelloWorld.java
Example program:
public class Main {
public static void main(String[] args) {
System.out.println("Hello, Rava2!");
var numbers = Arrays.asList(1, 2, 3, 4, 5);
numbers.stream()
.filter(n -> n % 2 == 0)
.forEach(System.out::println);
}
}
Supported Java Features
| Category | Features |
|---|---|
| Types | Classes, interfaces, enums, records, sealed classes, generics |
| Control Flow | if/else, for, while, switch expressions, try-catch-finally |
| Modern Features | Lambdas, method references, streams, pattern matching, text blocks, var |
| Threading | Thread creation, join, sleep, synchronized blocks |
| I/O | File operations, readers, writers, buffered streams |
| Networking | TCP sockets, server sockets, HTTP support |
Documentation Guide
- Installation - Build and install Rava2
- Syntax Basics - Tokens, keywords, operators
- Types and Declarations - Classes, interfaces, generics
- Control Flow - Loops, conditionals, exceptions
- Modern Features - Lambdas, streams, pattern matching
- java.lang API - Core classes: String, Math, Thread
- java.util API - Collections: ArrayList, HashMap, Stream
Running Examples
Rava2 comes with example programs demonstrating various features:
./rava2 examples/01_hello_world.java
./rava2 examples/08_lambdas_streams.java
./rava2 examples/20_basic_threads.java
Visit the Examples page to try them interactively.