Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: What algorithm is commonly used in Static Scope implementation
1 point by ejanus on Dec 11, 2014 | hide | past | favorite | 1 comment
I am currently trying to understand programming language design, and I am also reading source codes of a couple of languages. I would need help in understanding how Static Scope is implemented. Are there some popular algorithms out there I might need to go through? Any links? And if there is someone out there currently designing and implementing a language who won't mind having a mentee (online)?


Scoping is literally just a sequential list of associative lists to check in order. Nothing more than that.

Its simple to implement as a stack of hash tables, pushing a new hash table onto the stack when entering a scope, popping one off when you leave the scope. declarations add entries into the hash table at the top of the stack. Lookups traverse the stack top to bottom.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: