Wednesday, June 3, 2009

Example of Grammar

Construct the Language generated from the given Grammar.

S à aS /bS/є


Ans. In this production rule there are three productions S à aS, S àbS & S à. In  there is no non terminal, so in the language set there is null string (Λ). S can be replaced by aS, bS or .If S is replaced by aS in aS, it will be aaS. If S is replaced by bS, it will be abS. If S is replaced by aS in bS, it will be baS. If S is replaced by bS in bS, it will be bbS. If S is replaced by  in aS and bS it will be a and b respectively, which will belong to the language set. By this process we will get aa, bb, ab, ba, …, aba, bab....abaaba, …. Etc.

In a single statement we can represent the language set as “Any combination of a, b including null”

In mathematics it is represented as L(G) = {a,b}*

[ Any combination of a,b excluding null will represented by {a,b}+ ]

No comments:

Post a Comment