Skip to content

sjsanc/golox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golox

Lox implementations from Crafting Interpreters in Go.

Running the test suite

go test -v ./tests

Target a specific suite

go test ./tests -run "TestLoxSuite/tw/assignment"

Or file

go test ./tests -run "TestLoxSuite/tw/assignment/associativty.lox"

TODO

  • Move errors to seperate package

TW

Extensions

  • C-style block comments /* ... */
  • Ternary operator cond ? a : b
  • Shorthand ++ -- -= +=
  • break and continue
  • Arrays (indexing, length query, iteration) [] using Object
  • switch statements
  • String interpolation: "{}"
  • Anonymous functions: (params) => expr (params) => { stmt }

Optimisations

  • Compile-time constant folding (1 + 2 becomes 3)
  • Dead code elimination

About

Lox implemented in Go

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages