Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following figure illustrates how the interpreter stores symbols and variables together in the same space. Inside f(), User resolves to the local definition. Outside of the function, User resolves to the definition in the global space. The assignment to u in f() creates a local variable, defining it in the FunctionSpace object's members list.

Figure: Global, function, and struct memory spaces

That's basically it. A syntax-directed interpreter is little more than a parser that triggers action methods. These methods alter control-flow, shuffle data around in memory, and define symbols. The next section provides a complete implementation that fills in any remaining details for this pattern.

...