Commit Graph

27 Commits

Author SHA1 Message Date
ctsk
f1eeff583c [jlox] Classes 2022-09-17 22:17:52 +02:00
ctsk
a744ca18f9 Revert "[tlox] global vars"
This reverts commit c8f5edc494.
2022-09-17 20:48:05 +02:00
ctsk
c8f5edc494 [tlox] global vars 2022-09-15 17:22:00 +02:00
ctsk
63d502d6f9 [tlox] Add 'Nil' 2022-09-15 10:03:06 +02:00
ctsk
94ffb5370b [tlox] Add string and boolean literals 2022-09-14 22:55:19 +02:00
ctsk
b400c6b4ef [jlox] Add Resolution and Binding
A very subtle bug: The resolution relies on the fact that Java has a
concept of object identity: Even when the "Contents" of two objects are
equal, those objects are not considered equal.

This does not hold for records:
```
record Test(int val) {}

var a = new Test(1);
var b = new Test(1);

var m = new HashMap<>();
m.put(a, "Hello");
m.get(b); // returns "Hello"
```

tl;dr - got bitten by trying to do things fancy
2022-09-14 20:45:54 +02:00
ctsk
a1e5b4cb79 [tlox] Add Equality and Unary operands 2022-09-13 20:51:33 +02:00
ctsk
ed8f945f7f [tlox] Add support for comparisons 2022-09-13 19:05:17 +02:00
ctsk
a93b1018ca [tlox] Refactor to use Truffle DSL 2022-09-13 18:21:31 +02:00
ctsk
3c12f50b6f [tlox] Initial Expression parsing and evaluation 2022-09-13 17:31:30 +02:00
ctsk
1971ccef45 [jlox] experiment with stackless exception for Return 2022-09-10 21:17:15 +02:00
ctsk
12b0d6d0db [jlox] Add function declaration 2022-09-10 21:09:53 +02:00
ctsk
b83e6735f7 [jlox] Fix if bug 2022-09-10 21:01:11 +02:00
ctsk
8a1f0f1217 [jlox] Add function calls 2022-09-10 19:42:05 +02:00
ctsk
a516090b4f [jlox] Add for loops (using syntactic sugar!) 2022-09-10 11:46:18 +02:00
ctsk
a4c1076008 [jlox] Add while statement 2022-09-10 11:21:25 +02:00
ctsk
5327b3746a [jlox] Add branching 2022-09-10 11:08:21 +02:00
ctsk
dd09bb748f [jlox] Test Scanner 2022-09-09 22:27:46 +02:00
ctsk
fcd8b75ed6 Expression pretty printer 2022-09-09 12:35:27 +02:00
ctsk
2d1bad5701 Add assigments + scoping 2022-09-09 12:27:16 +02:00
ctsk
78cb1521df Add ExprStatement PrintStatement 2022-09-08 18:57:34 +02:00
ctsk
57681d2eeb Implement Expression interpreter 2022-09-08 11:30:26 +02:00
ctsk
e1247c3360 Parsing expressions done! 2022-09-08 10:04:33 +02:00
ctsk
e68f0edc1c Code Generation for Expression trees
- Ditched Gradle because I couldn't get annotation processing to work,
  switched to maven instead
2022-09-06 17:34:55 +02:00
ctsk
3857580ff0 Cleanup: Use idiomatic getOrDefault 2022-09-05 10:28:04 +02:00
ctsk
6dd507d76a Implement the Scanner 2022-09-03 20:22:29 +02:00
ctsk
9510b57e11 Initialize Jlox 2022-09-02 22:08:24 +02:00