zxul767 / lox

An interpreter for the Lox language
1 stars 0 forks source link

add `list` primitive type to `clox` #7

Closed zxul767 closed 1 year ago

zxul767 commented 1 year ago

jlox already implements the list primitive type (although it doesn't have literal syntax yet). clox should implement it too to have feature parity.

For its expected usage and API, look at samples/list.lox. The only additional piece of syntax needed is for indexing, which takes the form list[index]. In the jlox implementation we experimented with desugaring to a method call to __setitem__ and it worked quite well. We should document this in the (not yet written) spec for Lox.

zxul767 commented 1 year ago

marking as p0 simply because there's already WIP to implement this and we don't want to stall that.

zxul767 commented 1 year ago

this is now in main