Automating the process of finding leading/trailing set from a simple hardcoded While loop CFG in C and generating an operator precedence table from the sets. This is a very basic implementation in C.
S->w(C)bAe
O->p
C->iOn
C->iOi
A->L;A
A->f
L->i=E
E->T*F
T->i
F->n
S
is the start statew
representswhile
keywordp
represents conditional operators like==
,<=
,=>
,!=
b
representsbegin
A
represents the statementse
represents the end of the while loopC
represents a conditioni
represents an identifiern
represents a constantL
represents an assignmentE
represents an operation of an identifier and a constant