4 ms·
I just added array support: https://github.com/bbu/simple-interpreter/commit/392c38e78996a8fc3bda588342d04711166acce7 https://github.com/bbu/simple-interpreter/
by bluetomcat 11y ago
I just added array support: https://github.com/bbu/simple-interpreter/commit/392c38e78996a8fc3bda588342d04711166acce7 https://github.com/bbu/simple-interpreter/commit/392c38e7899...
The arrays themselves are dynamically realloc'ed and checked for out of bounds access. I've also added some runtime warnings for access to undefined variables and negative or out of bounds array access.
Also, there is an equivalence between variables and arrays: `var[0]` is the same as `var`.
All in 1466 lines :-)
- DougMerritt 11y agoExcellent, that's all good stuff. And yes, that's pretty concise. My toy interpreters tend to grow without bounds.