Skip to content

Tree-walk Interpreter for Robert Nystrom's Lox Language from Crafting Interpreters written in JavaScript

License

Notifications You must be signed in to change notification settings

davidhfriedman/jslox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jslox

A tree-walk interpreter for Bob Nystrom's Lox Language from Crafting Interpreters , written in JavaScript.

usage

node bin/main.js launches a REPL. prints the values of expressions (and null for statements)

node bin/main.js file loads, parses, and interprets the file then exits.

examples:

>print "Hello" + ", " + "world!";
Hello, world!

>print 19 + 2 < 20;
false

Debugging and testing

There are some test files in t/. Some of them follow Nystrom's convention of // expect:... comments. Nystrom has a test suite in the book's repo.

node bin/main.js t/testPrint1.lox

For quickie command line tests:

$ printf "var a = 19;\nprint a;\n" | npm run r

npm run r === node bin/main.js

wip status

2019-10-11 chapter 13 done, except for challenges

2019-10-10 chapter 12 done, except for challenges

2019-10-07 chapter 11 done, except for challenges

2019-10-02 chapter 10 done, except for anonymous functions challenge

About

Tree-walk Interpreter for Robert Nystrom's Lox Language from Crafting Interpreters written in JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published