Now Lemon Parser with VCG Graph
Visualization of Compiler Graphs (VCG):
The VCG for lemon parser is available. it has function ReportVcgGraph which generate the graph with the argument -v when compiling the lemon.
Function FindStates construct the State Table.Each State holds the action table if there is a shift then it holds next possible lookahead symbol with corresponding states.
Construction of VCG Graph :
we have to travel all the states. For each and every state we have to check whether we have next possible actions if so then create new edges with all possible actions.
Elements of VCG graph
Node :
Each and every state is represented by the node. Inside the node the label holds the config list
Edge :
All the lookahead symbol of each state. The Edge points to the next possible state.
actiontable ->x.stp->statenum
ex:
lemon -v example1.y
Code:
http://www.gnudeveloper.com/software/lemon/vcg/lemon.c