|
| 1 | +# KtLox |
| 2 | +Kotlin Treewalk Interpreter for Lox |
| 3 | + |
| 4 | +## Introduction |
| 5 | +KtLox is an implementation of the programming language Lox in Kotlin. Currently it uses naive treewalk interpreter, and is not optimized for speed. The initial version of KtLox has only features already present in the original JLox/CLox, but subsequent versions will continue to add new features to make it a powerful language. This is an experiment on the design and implementation of language features. |
| 6 | + |
| 7 | +The original version of Lox programming language can be found at Bob Nystrom's repository: |
| 8 | + |
| 9 | +https://github.com/munificent/craftinginterpreters |
| 10 | + |
| 11 | +## Features |
| 12 | +- Lexer, Parser and Treewalk Interpreter |
| 13 | +- Unary and Binary Expression/Operators |
| 14 | +- If and Else Statement |
| 15 | +- While and For Loop |
| 16 | +- Break Statement(challenge from the book) |
| 17 | +- Scope and Environment |
| 18 | +- Functions and Closures |
| 19 | +- Resolver and Semantic Analysis |
| 20 | +- Anonymous Functions(challenge from the book) |
| 21 | +- Classes and Objects |
| 22 | +- Methods and Property Getters |
| 23 | +- Inheritance and this/super keywords |
| 24 | +- Metaclasses(challenge from the book) |
| 25 | +- Traits(challenge from the book) |
| 26 | + |
| 27 | +## Roadmap |
| 28 | + |
| 29 | +### KtLox v1.1.0(current version) |
| 30 | +- Improved object model - Everything is an object, including nil, true, false, number, string, etc. |
| 31 | +- Framework for writing Native functions and classes. |
| 32 | +- root class Object which serves as superclass of every class. |
| 33 | + |
| 34 | +### KtLox v1.2.0(next version) |
| 35 | +- Full Fledged Standard Library: Boolean, Number, String, Array, Dictionary, DateTime, etc. |
| 36 | +- Mechanism for efficiently loading standard library at interpreter startup. |
| 37 | +- (maybe) Split the Number class, which will distinguish between integers and floating numbers. |
| 38 | + |
| 39 | +### KtLox v1.3.0 |
| 40 | +- Syntactic Sugar for Array/Dictionary Literals. |
| 41 | +- Short closures/lambda expression. |
| 42 | +- (maybe) Null-safe operator (?.). |
| 43 | + |
| 44 | +### KtLox v1.4.0 |
| 45 | +- Immutable variable declaration with **val**. |
| 46 | +- Function/method parameters are immutable by default(unless var keyword is used). |
| 47 | +- (maybe) Allow properties/instance variables to be defined inside the class statements, instead of initializers. |
| 48 | + |
| 49 | +### KtLox v1.5.0 |
| 50 | +- Refinement of metaclass system to match smalltalk's metaobject protocol. |
| 51 | +- Improvement of trait system in KtLox. |
| 52 | +- Add some Metaclasses and traits to the standard library. |
| 53 | + |
| 54 | +### KtLox v1.6.0 |
| 55 | +- Introduction of Namespace for KtLox's module system. |
| 56 | +- Allow importing namespaces and aliasing of imported classes/functions. |
| 57 | +- Redesign the existing standard library with namespaces(KtLox.Standard package). |
| 58 | + |
| 59 | +### KtLox v1.7.0 |
| 60 | +- Exception handling: throw statement, try/catch/finally statement, etc. |
| 61 | +- Add class Exception as well as a few more exception subclasses to the standard library. |
| 62 | +- (maybe) Pattern Matching |
| 63 | + |
| 64 | +### Ktlox v1.8.0 |
| 65 | +- Operator Overloading: enable user defined classes to overload operators, these operators are treated as method calls. |
| 66 | +- Method interception when an undefined method call is invoked on an object/class, similar to Smalltalk's doesNotUnderstand: message. |
| 67 | +- (maybe) Semicolon inference that allows semicolons to be omitted when its obvious that the statement is finished at the end of the line. |
| 68 | + |
| 69 | +### KtLox v1.9.0 |
| 70 | +- Introduction of async and await keywords, which allows C#/JS style of concurrency. |
| 71 | +- Add class Promise(or Future) to the standard library, which represents an async task to be completed in future. |
| 72 | +- (maybe) Continuation and Context, similar to smalltalk style stack manipulation. |
| 73 | + |
| 74 | +### KtLox v2.0.0 |
| 75 | +- Optional static typing support for instance variables and function/method parameters. |
| 76 | +- (maybe) Type inference for immutable variables, as well as possible optimization for typed variables. |
| 77 | +- (maybe) Slot as refied variables, similar to Pharo Smalltalk and Self's implementation. |
0 commit comments