Alpha Chen
97371d13be
11.3.1
2 years ago
Alpha Chen
0464eb1750
10.challenges.1
...
> 1. Our interpreter carefully checks that the number of arguments
passed to a function matches the number of parameters it expects. Since
this check is done at runtime on every call, it has a performance cost.
Smalltalk implementations don’t have that problem. Why not?
Because the arguments are part of the function signature.
2 years ago
Alpha Chen
b5bbfa6e48
10.6
2 years ago
Alpha Chen
fdacd541cb
10.5.1
2 years ago
Alpha Chen
264b30200c
10.5
2 years ago
Alpha Chen
91dc2b2c66
10.4.1
2 years ago
Alpha Chen
a944813d0d
10.4
2 years ago
Alpha Chen
b23936ade6
10.3
2 years ago
Alpha Chen
23c9bd5174
10.2.1
2 years ago
alpha
29d285dc45
10.1.4
...
FossilOrigin-Name: f49d9465e02a773fe8b1add8537291fd03620b1c6f14f3b0846a4aa4d362ee5f
2 years ago
alpha
355831dc29
10.1.2
...
FossilOrigin-Name: fae7fe1a493cd7d2c31e140204cfd581080c6bf5a70ed967107a1a5237bed129
2 years ago
alpha
c7504ddfe8
10.1.1
...
FossilOrigin-Name: c0a4d7dadf87d80ec3d0b6ef67e74d6c49d3ff2efa3179acf0ed90599b476efd
2 years ago
alpha
721546df59
10.1
...
FossilOrigin-Name: c1d35386c76ad60362ec68d9e94a6e4fe9cfc02c39b7c2589668a214a3f22c43
2 years ago
Alpha Chen
e2fbab63a7
set ruby-version to 3.1
2 years ago
alpha
b13eb90bdb
merge 10.1 work
...
FossilOrigin-Name: f3601e8f1a20360b1d0eb74e790601a4911d458705dd34ff4e25f7d4aba0a632
2 years ago
alpha
fe7e902211
10.1.4
...
FossilOrigin-Name: f49d9465e02a773fe8b1add8537291fd03620b1c6f14f3b0846a4aa4d362ee5f
2 years ago
alpha
28b9fd32d0
10.1.2
...
FossilOrigin-Name: fae7fe1a493cd7d2c31e140204cfd581080c6bf5a70ed967107a1a5237bed129
2 years ago
alpha
2a5230c925
10.1.1
...
FossilOrigin-Name: c0a4d7dadf87d80ec3d0b6ef67e74d6c49d3ff2efa3179acf0ed90599b476efd
2 years ago
alpha
4b48ef1a75
10.1
...
FossilOrigin-Name: c1d35386c76ad60362ec68d9e94a6e4fe9cfc02c39b7c2589668a214a3f22c43
2 years ago
alpha
d6f05497e3
9.challenges
...
> 1. A few chapters from now, when Lox supports first-class functions and dynamic
dispatch, we technically won’t need branching statements built into the
language. Show how conditional execution can be implemented in terms of those.
Name a language that uses this technique for its control flow.
Smalltalk? Lox doesn't have dictionaries, but in Ruby:
```ruby
def if_(cond, t, f)
{ true => t, false => f }[cond].()
end
```
> 2. Likewise, looping can be implemented using those same tools, provided our
interpreter supports an important optimization. What is it, and why is it
necessary? Name a language that uses this technique for iteration.
Tail recursion, Lisp?
FossilOrigin-Name: aec62b2632ecda95e950b0ea1a2cc7605db12f28cbbaf579f62519a4d5679aa4
2 years ago
alpha
66726f8e69
9.5.1
...
FossilOrigin-Name: e6003611fc9c7f22e8ab96c338f79c3f8a0ddd7ff15b21a37568b4b6c3f54329
2 years ago
alpha
8350af2632
9.4
...
FossilOrigin-Name: 58225e550ec53fff4dcdde3678d5850dd91a285ad4ab247baa1fbf71e8d73206
2 years ago
alpha
ce8c69136a
remove Visitable
...
FossilOrigin-Name: e45d353b7eddcab310ec5059d9ddc51a202526b145aa121d3c77815af59e43d1
2 years ago
alpha
cd50d4283e
9.3
...
FossilOrigin-Name: a8acba027eac65be97ac3bcd57fbdd71b177c922f1bc8c18deb9864de2a9da33
2 years ago
alpha
556e5e796c
9.2
...
FossilOrigin-Name: d0e9947d95fd8cad638edb04ff5d9d450516434320a54f6d478214d6e90800b5
2 years ago
alpha
42dd033fb4
add test for uninitialized vars
...
FossilOrigin-Name: 9b734dc92b4bca6a25fde30f556565d5a48a64f9a9531c89f2927f6674e82a70
2 years ago
alpha
e21f070968
8.challenges.1
...
FossilOrigin-Name: 4dd1670a4466cf079d61e11677e4aa8dd9b9ec096700e2ae565a4073ec4efc12
2 years ago
alpha
ce32eea3d9
8.5.2
...
Also add typeprof for the LSP
FossilOrigin-Name: 5083d12e51edc11e5c25174af3fb0276b6a1952a28184b8f43079b6907e2caf5
2 years ago
alpha
b879ae44ff
8.5.1
...
FossilOrigin-Name: f2b21a08789cde121fca0488c7fbe95cb01b98589dc92ac383f4d42847b2433e
2 years ago
alpha
1cb62101d8
8.4.2
...
FossilOrigin-Name: 0d44d8a3a62b9bd884f12a5497f7b085c6727ae0861100ca22488b67564750df
2 years ago
alpha
fb649eeaba
8.4.1
...
FossilOrigin-Name: f908d358ac9f54ee9935ba8f2b55c54e072cdda14ed3693b6959a828aef34a65
2 years ago
alpha
44ab6454fa
8.3.1
...
FossilOrigin-Name: d3638720b7f16b1b5de8cec037b39a3bc9145f029a6456cb1772ddb3a852075f
2 years ago
alpha
f588717d58
remove squash now that I've reset the subtree
...
FossilOrigin-Name: 63f04ad0db250f44f58d52772d6e4eb152fcfc96516970ea5d1a05a65b0c1d34
2 years ago
alpha
a993e409a5
8.3
...
FossilOrigin-Name: f181ea92bf9d0adda566afb9f62c7ef4fa313761377cd3cf888c83a0b14f5188
2 years ago
alpha
d09f24248e
I guess you have to squash commits?
...
Too lazy to look into how to keep individual commits with unrelated histories
FossilOrigin-Name: 0d3362887de6be5ddf4d357073e35a38c897485f97b796930bbe49ac1f58cbba
2 years ago
alpha
4b1d6e58a5
8.3
...
FossilOrigin-Name: 485f20b296cc9e9eb567580bff6d3ef8655a1200720388070503b3cdb7abde77
2 years ago
alpha
a4abf0b0b7
don't squash changes
...
FossilOrigin-Name: 93ed5e034b4ef580682abfbb78a17928b95690180d49272d20f23be9c4567788
2 years ago
alpha
22a126dd0b
8.1
...
FossilOrigin-Name: 5d014cbe85c713fbe1fccf2a053db4b4474c0eee5e909d7cfd7de58fcbb03f77
2 years ago
alpha
cf72deef8b
make a Visitable module
...
FossilOrigin-Name: 3ffc71c707c994c44a9f33025ed50ab91d2a7e60be6c639b6ed28798d82728a2
2 years ago
alpha
b651c84d9b
7
...
FossilOrigin-Name: ae1ca40694300eff97d7ee3961f0e8e0b1f61f275c8226872ac1b502c5343b07
2 years ago
alpha
dd97e96aca
run lox tests from the book's repo, inspired by @hparker
...
FossilOrigin-Name: f477507f650934b9117cce181e4cdc50dda31c1126651319132feb7c768a1a93
2 years ago
alpha
18be1863dd
6
...
FossilOrigin-Name: 53d2e006949bbca6adb34110c64c3288c1077e2cb8ba71ef24803b81aedccb12
2 years ago
alpha
a2a685bc47
split out lox.rb into multiple files
...
FossilOrigin-Name: 9f8294ceb7aa3c4ad7ea96bafc90afceb8211dc8fabae66a4ace9560aa99eba4
2 years ago
alpha
3cd5ba6587
organize files into bin, lib, and test dirs
...
FossilOrigin-Name: a207bd9de54f2c13c832a51c766d663b04e2904e72c178756ebba72a0c15a289
2 years ago
alpha
2e4377b600
implement AstPrinter
...
FossilOrigin-Name: ed84fb6a6150359d3756c8636af19f487cb4da6fc2f21a6147b335751416a06f
2 years ago
alpha
3330fe5d62
fail tokenizing if there are errors
...
FossilOrigin-Name: 070ae9c41a27c56f13509c7a7ceffb7e0b16fe61b21248b8271c363e3c5b9abe
2 years ago
alpha
ccf9e0e19c
nicer formatting
...
FossilOrigin-Name: b01735adaf1a9640b7a1ade14effce83de8c90305df1c0f6077b71a6022d90d4
2 years ago
alpha
6b083fd884
use transform_values for `TOKENS`
...
FossilOrigin-Name: ecc9a6364a3e9096050cb7ada97436c9a03514ca50e2ca3d50e19f5ff70a8fd3
2 years ago
alpha
7559cd2b8e
simplify token scanning
...
Stole this idea from @tenderlove
FossilOrigin-Name: 3d144d88cb447e1f5d4c79c0a3185cd80fe879b3ab8d039d20bec255db7bbbb5
2 years ago
alpha
b4e4edfe8c
allow for single character identifiers
...
FossilOrigin-Name: 6f663cda900d2517ff10ddcf74b1e294e3f07cb415bf7d00157b36fe7c780b72
2 years ago