Regular_grammar Regular_grammar

Regular grammar - Definition and Overview

Related Words: Democrat, Ok, Republican, Tory, Whig, Absolute, Annual, Army, Arranged, Array, Automatic, Average

In computer science a right regular grammar is a formal grammar (N, Σ, P, S) such that all the production rules in P are of one of the following forms:

  1. Aa - where A is a non-terminal in N and a is a terminal in Σ
  2. AaB - where A and B are in N and a is in Σ
  3. A → ε - where A is in N.

In a left regular grammar, all rules obey the forms

  1. Aa - where A is a non-terminal in N and a is a terminal in Σ
  2. ABa - where A and B are in N and a is in Σ
  3. A → ε - where A is in N.

An example of a right regular grammar G with N = {S, A}, Σ = {a, b, c}, P consists of the following rules

S → aS
S → bA
A → ε
A → cA

and S is the start symbol. This grammar describes the same language as the regular expression a*bc*.

A regular grammar is a left regular or right regular grammar.

The regular grammars describe exactly all regular languages and are in that sense equivalent with finite state automata and regular expressions.

Every regular grammar is a context-free grammar.

Every context-free grammar can be easily rewritten into a form in which only a combination of left regular and right regular rules is used. Therefore, such grammars can express all context-free languages. Regular grammars, which use either left-regular or right-regular rules but not both, can only express a smaller set of languages, called the regular languages. In that sense they are equivalent with finite state automata and regular expressions. (for illustration: the paradigmatic context-free language with strings of the form <math>a^ib^i<math> is generated by the grammar G with N = {S, A}, Σ = {a, b}, P with the rules

S → aA
A → Sb
S → ε

and S being the start symbol. Note that this grammar has both left-regular and right-regular rules and is therefore not regular any more.) Some textbooks and articles disallow empty production rules, and assume that the empty string is not present in languages.

See also: Chomsky hierarchy

Example Usage of Regular

MissyCo124: im on a bus! its been 10yrs since i was on a Regular bus! lmao
snjohnson1971: Follow @marlonberesford for w/e footy action, blurred vision and Regular updates on RCA..looking good Bez http://yfrog.com/3nxu9ij
nikolay: @centernetworks I had to use the Regular LogMeIn today and it gave me a headache to explain to my co-worker. No more headaches with Express!
Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.