A compiler for a language such as C creates a spaghetti stack as it opens and closes symbol tables representing block scopes.
If the expression refers to a variable X, it is 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 continuations.
This type of structure also solves both the upward and downward funarg problems, as a result first-class lexical closures are readily implemented in that substrate.
Examples of languages that use spaghetti stacks are: Mainframe computers using the Burroughs Large Systems architecture and running the MCP operating system can spawn multiple tasks within the same program.