Formal grammar is represented as G = (N, T, P, S) with Non-terminals, Terminals, Productions, Start symbol.