+void inst_field(Thread* thread, Argument argument) {
+ assert(!Stack_isEmpty(&(thread->stack)));
+ Object key = Stack_pop(&(thread->stack));
+ assert(key.type == SYMBOL);
+
+ assert(!Stack_isEmpty(&(thread->stack)));
+ Object structure = Stack_pop(&(thread->stack));
+ assert(structure.type == STRUCTURE);
+
+ while(structure.value.structure != NULL) {
+ if(strcmp(structure.value.structure->key, key.value.string) == 0) {
+ Stack_push(&(thread->stack), structure.value.structure->value);
+ return;
+ }
+ structure.value.structure = structure.value.structure->next;
+ }
+
+ assert(false); // Symbol wasn't found in structure
+}
+
+void inst_get(Thread* thread, Argument argument) {
+ assert(!Stack_isEmpty(&(thread->stack)));
+ Object indexObject = Stack_pop(&(thread->stack));
+ assert(indexObject.type == INTEGER);
+ int32_t index = indexObject.value.integer;
+
+ assert(!Stack_isEmpty(&(thread->stack)));
+ Object listObject = Stack_pop(&(thread->stack));
+ assert(listObject.type == LIST);
+ List* list = listObject.value.list;
+
+ while(index > 0) {
+ assert(list != NULL);
+ list = list->tail;
+ index--;
+ }
+
+ assert(list != NULL);
+ Stack_push(&(thread->stack), list->head);
+}
+