System Architecture

Rava2 follows a classic tree-walk interpreter architecture, optimized for performance and safety.

Pipeline

  1. Lexer: Converts source code into a stream of tokens.
  2. Parser: Uses recursive descent and Pratt parsing to build an Abstract Syntax Tree (AST).
  3. Runtime: The VM traverses the AST and executes nodes using a stack-based frame system.

Core Components

  • Arena Allocator: Used for transient memory during the parsing phase.
  • VM Stack: Manages method calls and local variables.
  • Object Heap: Managed by the Garbage Collector.

The interpreter is written in modular C, with clear separation between the lexer, parser, runtime, and garbage collector.