theodore-norvell / PLAAY

Senior Design Project PLAAY (Programming Language for Adults And Youth)
2 stars 0 forks source link

Created array literal label #130

Closed WNewhook closed 6 years ago

WNewhook commented 6 years ago

Created a literal label for arrays. Like with objects, I didn't do the interpreter side.

I figure that arrays and objects will work very similarly for the interpreter. My assumption is that, with objects, you need to explicitly declare fields and give them names for them to be accessible. However in arrays, I assume that the declaration is implicit, so every child of the array node will be in the final array. i.e. this:

array_example

will become an ObjectV with three fields: 0 ::= "test1", 1 ::= "test2", and 2 ::= 10.

This is why I don't allow variable declarations to be children of the array literal. It doesn't make sense to allow them for the same reason that we can't declare a variable to be another variable declaration.