Family Friends / Investors
The Spreadsheet Analogy

You already understand
Attribute Grammars

You just call them spreadsheets.

See for yourself

Change a number on either side. Watch everything update.

A Spreadsheet
A
B
1
=A1 * 2 20
2
=A2 * 2 40
3
=A1 + A2 30
=B1 + B2 60
Try changing A1 or A2
A Tree with Attributes
Add result = 30 Num( ) value = 10 Num( ) value = 20 SYNTHESIZED (flows up)
Try changing Num(10) or Num(20)
Same numbers. Same formulas. Same auto-recalculation.
A spreadsheet and an attribute grammar are the same idea.

The Connection

Every concept in a spreadsheet has a direct parallel in an attribute grammar.

Spreadsheet Attribute Grammar
Cell = Node in a tree
Formula = Equation
Cell value = Attribute value
Formula dependencies = Attribute dependencies
Auto-recalculation = Evaluation
"The spreadsheet figures out
what order to calculate"
= "The framework figures out
what order to evaluate"
You define what each value depends on. The system figures out when to compute it. That is the core insight of both spreadsheets and attribute grammars.

Now Scale It Up

The analogy only gets stronger at scale.

A spreadsheet with 5 cells is easy. A spreadsheet with 50,000 cells needs Excel.

A tree with 3 nodes is easy to hand-code. A tree with 50,000 nodes needs an AG framework.

Toy example
3 nodes
Hand-code it
Real module
500 nodes
Getting painful
Real program
50,000 nodes
You need a framework

Effort to maintain

Hand-coded
0%
AG framework
0%

As trees grow, hand-coded complexity explodes. Framework complexity stays flat.

One More Thing: Inherited Attributes

Spreadsheets mostly compute bottom-up. But attribute grammars can also pass information down the tree. These are called inherited attributes.

Think of it this way
Imagine if a spreadsheet cell could see its column header automatically — that is context flowing downward. In an AG, a parent can pass context to its children, who pass it to theirs.
Program depth = 0 size = 4 Function depth = 1 size = 3 Variable depth = 1 size = 1 Param depth = 2 size = 1 Body depth = 2 size = 1
Inherited — flows down (depth)
Synthesized — flows up (size)

depth is an inherited attribute: each parent tells its children "you are one level deeper than me." It flows downward.

size is a synthesized attribute: each node reports its subtree size upward to its parent.

Information flowing both ways at once — that is what makes attribute grammars more powerful than a flat spreadsheet. And the framework handles all of it automatically.