The attribute grammar approach is widely used in compiler construction.
There are some methods for implementing graph data structures such as graph adjacency matrix. We'll use the method of holding pointers to neighbor graph elements right into every node. This method has the property of locality: every node knows only its neighbors. While you are traversing the knowledge graph, this pointers set is short and enough. The advantage of this method it is tightly native to any programming language which supports object-oriented programming:
For the expression 1+2*3 we can draw this object graph:
or more precisely, with type/class **tag
**s paired to node **value
**s:
the mandatory <T:V>
part of every node