Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
11 user(s) are online (11 user(s) are browsing encyclopedia)

Members: 0
Guests: 11

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

Spaghetti stack

A spaghetti stack is an N-ary tree data structure in which child nodes have pointers to the parent nodes. When a list of nodes is traversed from a leaf node to the root node by chasing these parent Pointers, the structure looks like a linked list Stack (computing). You can just pretend that the one and only parent pointer is called next or link , and ignore that the parents have other children, which are not accessible anyway since there are no downward pointers.

Spaghetti stack structures arise in situations when records are dynamically pushed and popped onto a stack as execution progresses, but references to the popped records remain in use.

For example, a Compiler for a language such as C programming language creates a spaghetti stack as it opens and closes symbol tables representing block scopes. When a new block scope is opened, a symbol table is pushed onto a stack. When the closing curling brace is encounterd, the scope is closed and the symbol table is popped. But that symbol table is remembered, rather than destroyed. And of course it remembers its higher level parent symbol table and so on. Thus when the compiler is later performing translations over the abstract syntax tree, for any given expression, it can fetch the symbol table representing that expression s environment and can resolve references to identifiers. If the expression refers to a variable X, it s first sought after in the leaf symbol table representing the inner-most lexical scope, then in the parent and so on.

The term spaghetti stack is closely associated with implementations of programming languages that support are readily implemented in that substrate also.

= See also =

  • Continuation
  • closure (computer science)