No description
  • Janet 90.8%
  • Nix 9.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-09-23 00:14:14 -04:00
bin install as janet bundle 2025-09-23 00:14:14 -04:00
lox detect duplicate local vars 2025-09-21 14:58:26 -04:00
test detect duplicate local vars 2025-09-21 14:58:26 -04:00
.gitignore ignore judge's .tested files 2025-09-17 19:18:01 -04:00
bundle.janet install as janet bundle 2025-09-23 00:14:14 -04:00
flake.lock initial commit with basic expression interpreter 2025-09-15 23:23:35 -04:00
flake.nix install as janet bundle 2025-09-23 00:14:14 -04:00
info.jdn install as janet bundle 2025-09-23 00:14:14 -04:00
LICENSE initial commit with basic expression interpreter 2025-09-15 23:23:35 -04:00
readme.md detect duplicate local vars 2025-09-21 14:58:26 -04:00

This is a Janet implementation of the Lox programming language, from Crafting Interpreters by Robert Nystrom. It's loosely based on jlox, the Java tree-walking interpreter from the book, but takes advantage of Janet features to simplify the code when possible.

Notably:

  • The scanner is a parsing expression grammar
  • Scoping is built on top of dynamic bindings
  • The repl uses Janet's getline, which wraps linenoise
  • While Janet has support for object-oriented programming, most of the code is written in a more functional style. For instance the visitor pattern is replaced by pattern matching

Progress

  • Scanning
  • Representing Code
  • Parsing Expressions
  • Evaluating Expressions
  • Statements and State
  • Control Flow
  • Functions
  • Resolving and Binding
    • Lexical scope
    • Prevent self-referential initializer
    • Prevent variable name reuse in same scope
    • Prevent top-level return
  • Classes
  • Inheritance