Internal representation for scopes

1 view
Skip to first unread message

segoe

unread,
Nov 22, 2009, 1:22:15 PM11/22/09
to JVM Languages
Currently in my interpreter scopes are represented as specialized
classes so:

Frame0, Frame1, Frame2, Frame3, Frame4
Those hold symbols and values for scopes that have zero to four
symbols respectively.

Frame5to10
This does the same but as a list, and uses binary search.

FrameN
From 10 up, we use a hashtable to represent symbols/values.
(note that in my language is common to use local scopes with 20 or 30
definitions)

I think this is mostly ok regarding performance, but i would like to
ask
is there a better way to do it?
Reply all
Reply to author
Forward
0 new messages