Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lox

A toy Lox language interpreter implemented while following the Crafting Interpreters book.

Status

The language implementation is not complete. Only the scanner (lexer) is functional so far. There is no entry point — only test files are runnable.

Notable deviations from the book

  • Language: TypeScript on Bun instead of Java/C.
  • Grammar generator: A custom PEG-grammar-to-opcodes compiler (grammar_builder.ts) built from scratch, not in the book.
  • Parser VM: A custom stack-based virtual machine (parser.ts) that interprets the opcodes produced by the grammar generator.
  • Two scanners: scanner.ts follows the book's class-based design; scanner2.ts is a separate experiment with a simpler union token type.

Setup

bun install

Tests

bun test

About

Toy Lox language interpreter from Crafting Interpreters, implemented in TypeScript/Bun with a custom PEG grammar generator and stack-based parser VM.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages