Janet implementation of Lox from the book Crafting Interpreters
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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