libera/#lisp - IRC Chatlog
Search
17:45:18
theseb
question about implementing lisp in C......lexical scoping requires storing function environments for each function definition.....I'm confused on best way to store all those function environments
17:47:41
White_Flame
if you don't care about speed, you can tag each key with your current function object
17:49:37
White_Flame
I think it's easier to use a single stack, or maybe 2 to separate dynamic from lexical
17:51:13
White_Flame
so you could have the keys in the list be (varname function-object) to avoid false matches
17:51:54
White_Flame
I was considering a single stack across all function calls, but there's likely better ways to do it
17:53:40
White_Flame
theseb: so anyway, are you considering just a bare-bones interpreter, an interpreter with mindfulness toward speed, or a compiler?
17:55:35
theseb
White_Flame: you have given me a big idea.....My original environment was a consecutive segment of memory...if I turned it into a linked list it would be more flexible
17:56:08
theseb
White_Flame: my mistake was thinking all these environments could be simple consecutive segments of memory
17:56:57
White_Flame
right. You can predict how many lexical variable bindings a function will need, but that's getting less simple