Production (computer Science) - Grammar Generation

Grammar Generation

To generate a string in the language, one begins with a string consisting of only a single start symbol, and then successively applies the rules (any number of times, in any order) to rewrite this string. This stops when we obtain a string containing only terminals. The language consists of all the strings that can be generated in this manner. Any particular sequence of legal choices taken during this rewriting process yields one particular string in the language. If there are multiple different ways of generating this single string, then the grammar is said to be ambiguous.

For example, assume the alphabet consists of and, with the start symbol, and we have the following rules:

1.
2.

then we start with, and can choose a rule to apply to it. If we choose rule 1, we replace with and obtain the string . If we choose rule 1 again, we replace with and obtain the string . This process is repeated until we only have symbols from the alphabet (i.e., and ). If we now choose rule 2, we replace with and obtain the string, and are done. We can write this series of choices more briefly, using symbols: . The language of the grammar is the set of all the strings that can be generated using this process: .

Read more about this topic:  Production (computer Science)

Famous quotes containing the words grammar and/or generation:

    Hence, a generative grammar must be a system of rules that can iterate to generate an indefinitely large number of structures. This system of rules can be analyzed into the three major components of a generative grammar: the syntactic, phonological, and semantic components.
    Noam Chomsky (b. 1928)

    The world is never the same as it was.... And that’s as it should be. Every generation has the obligation to make the preceding generation irrelevant. It happens in little ways: no longer knowing the names of bands or even recognizing their sounds of music; no longer implicitly understanding life’s rules: wearing plaid Bermuda shorts to the grocery and not giving it another thought.
    Jim Shahin (20th century)