package moe.nea.lisp class StackFrame(val parent: StackFrame?) { val variables = mutableMapOf() interface MetaKey private val meta: MutableMap, Any> = mutableMapOf() fun getMeta(key: MetaKey): T? { return meta[key] as? T } fun setMeta(key: MetaKey, value: T) { meta[key] = value } fun resolveReference(label: String): LispData? = variables[label] ?: parent?.resolveReference(label) fun setValueLocal(label: String, value: LispData): LispData { variables[label] = value return value } fun fork(): StackFrame { return StackFrame(this) } }