Lox interpreter written i Go.
Find a file
2025-02-03 16:03:42 +02:00
.vscode functions 2024-10-09 19:57:52 +03:00
tests wip on classes 2025-02-03 15:37:14 +02:00
.gitignore blocks, env 2024-10-05 23:27:00 +03:00
ast_string.go wip on classes 2025-02-03 15:37:14 +02:00
callable.go wip on classes 2025-02-03 15:37:14 +02:00
class.go wip on classes 2025-02-03 15:37:14 +02:00
env.go scope and binding 2024-10-14 22:53:26 +03:00
expr.go wip on classes 2025-02-03 15:37:14 +02:00
function.go wip on classes 2025-02-03 15:37:14 +02:00
globals.go closures 2024-10-12 00:09:25 +03:00
glox.go scope and binding 2024-10-14 22:53:26 +03:00
go.mod lexer 2024-09-29 18:45:11 +03:00
go.sum lexer 2024-09-29 18:45:11 +03:00
interpreter.go wip on classes 2025-02-03 15:37:14 +02:00
parser.go wip on classes 2025-02-03 15:37:14 +02:00
parser_test.go wip on classes 2025-02-03 15:37:14 +02:00
README.md readme 2025-02-03 16:03:42 +02:00
resolver.go wip on classes 2025-02-03 15:37:14 +02:00
scanner.go break 2024-10-07 21:47:55 +03:00
stack.go scope and binding 2024-10-14 22:53:26 +03:00
stmt.go class statement 2024-11-06 00:09:50 +02:00
tokentype_string.go break 2024-10-07 21:47:55 +03:00

GLOX

Lox interpreter written i Go.

This is ongoing project where I try to recreate "JLOX" language in Go instead of Java. It completly based on instructions from Bob Nystrom's book "Crafting interpretters".

Currently supported:

  • REPL
  • variables
  • functions
  • functions as values
  • closures
  • exceptions
  • classes
  • scoped blocks
  • conditions
  • loops
  • basic arithmetic
  • AST printing
  • error recovery

TODO:

  • Virtual Machine
  • Intermediate representaion

Run

Simply compile and run binary. By default you will get REPL session.

go build
./glox
> print 1 + 1;

If you want to run script - just pass script path as an argument:

go build
./glox ./tests/functions.lox

Testing

TODO