Skip to content

pvsr/janet-lox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Janet interpreter for the Lox programming language

Topics

Resources

License

Stars

Watchers

Forks

Contributors