What is the right code for implementing the class hierarchy of frames?
I look at the base Frame class as a universal data (and code) type, can hold both single scalar values, and nested elements, all of them can be attributed by arbitrary slots. Making oriented graphs of such nodes with types inherited from the base Frame, we can model any type of data. Some subset of frames can be treated as executable so we can implement a homoiconic computing system.
type
Frame = ref object of RootObj
typ: string
val: string
slot: Table[string,ptr Frame]
nest: seq[ptr Frame]
let nst = Frame(val:"nested")
let hello = Frame(typ:"hello",val:"world",nest:@[nst])
echo hello[]
IMO, those links are too theoretical and you most probably need domain knowledge and actual use cases to know the best data structures to represent Frames.
Looking around you can probably re-use OO techniques though: https://en.wikipedia.org/wiki/Frame_language#Comparison_of_frames_and_objects.
Couple of notes:
My advice to go forward:
Check performance from time to time on non-toy inputs.