Alex Rivera | Logout

How is scope of variable implemented in compiler at machine level or memory level

Asked 2012-11-02T16:55:52.880
9

How is scope of a variable is implemented by compilers? I mean, when we say static variable, the scope is limited to the block or functions that defined in the same file where the static variable is defined? How is this achieved in machine level or at memory level?

How actually is this restriction achieved?

How is this scoping resolved at program run time?

Edit
Report

1 Answer

1

inside compilers, its implementation defined. For example if I were writing a compiler, I would use a tree to define 'scope' and it would definitely be a symbol table inside a binary tree.

Some would use an arbitrary depth Hash table. Its all implementation defined.

answered 2012-11-02T16:59:09.370

Your Answer