Skip to content

h2oboi89/lox

Repository files navigation

Summary

Lox interpreter written in C# (.NET 7)

This is my 2nd attempt. First one can be found here: https://github.com/h2oboi89/lox.archive

Based on Bob Nystrom's Lox book

Sections Completed

Links are organized as [online book link] : [source code tag link].

NOTE: some sections do not contain a tag link as they only represent a partial section of code that did not lend itself to testing.

Tree-walk Interpreter

Bytecode Virtual Machine

Deviations / Enchancements

  • Reworked interpreter to facilitate testing (see Interpreter.Tests)
  • Superclass format is like C# (class : superclass) instead of using <

TODO

  • block comments

  • ternary expressions

  • comma separated expression (var a = 1, var b = 2;)

  • detect divide by zero

  • REPL autoprints expressions

  • add continue and break

  • anonymous functions

  • report unused variables

  • static methods for classes

  • public, private, protected fields and methods

  • getters and setters

  • multiple inheritance

  • interfaces

  • read user input built-ins

  • namespaces and imports?

  • enforce class name is upper case

  • virtual, abstract, override

  • warn user if field overrides method name

  • make print a built-in function

  • global scope not special (no more multiple declarations)

  • allow single line functions (no braces)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages