8000 GitHub - pvsr/janet-lox: Janet interpreter for the Lox programming language · GitHub
[go: up one dir, main page]

Skip to content
< 7FFF script type="application/json" data-target="react-partial.embeddedData">{"props":{"color_mode":"dark","logged_in":false,"marketing_page":false,"home_path":"/","login_path":"/login?return_to=https%3A%2F%2Fgithub.com%2Fpvsr%2Fjanet-lox","signup_path":"/signup?ref_cta=Sign+up\u0026ref_loc=header+logged+out\u0026ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E\u0026source=header-repo\u0026source_repo=pvsr%2Fjanet-lox","signup_enabled":true,"is_signup_controller":false,"show_search_and_nav":true,"hide_search":false,"private_mode_enabled":false,"should_use_dotcom_links":true,"auth_hydro_click":"{\"event_type\":\"authentication.click\",\"payload\":{\"location_in_page\":\"site header menu\",\"repository_id\":null,\"auth_type\":\"SIGN_UP\",\"originating_url\":\"https://github.com/pvsr/janet-lox\",\"user_id\":null}}","auth_hydro_click_hmac":"70e42b999d312e1ef1b79f692d886681a000e56573ea1a9918cf7c07608f138f"}}
pvsrPublic

About

Janet interpreter for the Lox programming language

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

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

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages

0