slox
Swift Implementation of a Lox Interpreter.
Lox is a dynamically typed and turin complete programmimng language.
[!NOTE] This implementation have achieved 100% of Lox's main specification. And couple challenge specification. I have plan to work on a Swift based DSL that builds on top of this project; and a compiled version of Lox with a lower level lanaguge. I consider Slox as done.
This project follows the book Crafting Interpreters written by Bob Nystrom.
[!NOTE]
This project sometimes deviate from offical implementation in the book (the interpreter not the language). For better conformance with Swift feature and standard paractice. I also made an effort to make this project more extensible, since I intend to use this as foundation for future project.
Progress
- Scanner
-
\**\
style comments - Comprehensive Tests
-
- Abstract Syntax Tree
- Code generator
- Cli tool
- Generation from JSON
- AST Printer
- Pretty Printer
- Essential types
- Basic Tests
- Comprehensive Tests
- Parser
- Basic expression
- Extended expressions (comma operator, ternary operator
?:
) - Error productions to handle each binary operator appearing without a left-hand operand
- Statement
- Error recovery
- Basic Tests
- Comprehensive Tests
- Interpreter
- Basic expression
- Statements
- States
- Scoping
- Control Flows
- Break and Continue
- Functions
- Foreign/Native Function
- Classes
- Runtime Entities (Callable, LoxClass, LoxFunction, & LoxInstance)
- Inheritance
- Expression support for REPL mode
- Integration Tests / Lox Scripts
- Resolver
- Static Analysis
- Top-level return
- Undefined Variable
- Local Scope variable declaration
Reference
- Original Implementation
- The slox implementation I referenced.