zxul767 / lox

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

add support for bracket index access to `list` in `jlox` #14

Closed zxul767 closed 1 year ago

zxul767 commented 1 year ago

currently, access is achieved via:

var l = list()
l.append(1)
print l.at(0)

but given how common such an operation is, and that list is a primitive, we should support the following syntax as well:

print l[0]

where the index can, of course, be any valid expression that evaluates to an integer.

zxul767 commented 1 year ago

this is now in main.