Independent build · Language tooling

Brainrot-Interpreter

A TypeScript interpreter built to explore language design, abstract syntax trees, parsing, and lexing.

Status
In progress
Role
Independent language experiment
Portfolio capture
21 October 2024
Brainrot-Interpreter project documentation
Version 0.1 of the terminal REPL evaluating arithmetic and reporting a parser-stage error.

What it solves

Interpreters can feel abstract when studied only as theory. This experiment turns the compiler pipeline into something observable by accepting expressions in a terminal, producing typed values, and exposing where invalid syntax fails.

The captured version 0.1 REPL evaluates arithmetic input and returns a typed number result, while invalid comparison syntax produces a named parsing error with the unexpected token instead of failing silently.

Architecture

Bun entrypoints
File and REPL inputs share the same parser, global environment, and evaluator.
Lexer and AST parser
The lexer emits typed tokens, then the parser builds a statement-based AST.
Scoped evaluator
AST nodes dispatch to expression and statement evaluators backed by nested environments.

Technology

  • TypeScript
  • Bun
  • Lexer
  • Parser
  • AST
  • REPL