Regular grammar
In theoretical computer science and formal language theory, a regular grammar is a grammar that is right-regular or left-regular.[src] While their exact definition varies from textbook to textbook, they all require that * all production rules have at most one non-terminal symbol; * that symbol is either always at the end or always at the start of the rule's right-hand side.[src] Every regular grammar describes a regular language.[src]
In theoretical computer science and formal language theory, a regular grammar is a grammar that is right-regular or left-regular.[src] While their exact definition varies from textbook to textbook, they all require that all production rules have at most one non-terminal symbol; that symbol is either always at the end or always at the start of the rule's right-hand side.[src] Every regular grammar describes a regular language.[src] 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.[src] This grammar describes the same language as the regular expression a*bc*, viz.[src] the set of all strings consisting of arbitrarily many "a"s, followed by a single "b", followed by arbitrarily many "c"s.[src] A somewhat longer but more explicit extended right-regular grammar G for the same regular expression is given by N = {S, A, B, C}, Σ = {a, b, c}, where P consists of the following rules: S → A A → aA A → B B → bC C → ε C → cC ...where each uppercase letter corresponds to phrases starting at the next position in the regular expression.[src] As an example from the area of programming languages, the set of all strings denoting a floating point number can be described by an extended right-regular grammar G with N = {S,A,B,C,D,E,F}, Σ = {0,1,2,3,4,5,6,7,8,9,+,−,.,e}, where S is the start symbol, and P consists of the following rules: ==Expressive power== There is a direct one-to-one correspondence between the rules of a (strictly) right-regular grammar and those of a nondeterministic finite automaton, such that the grammar generates exactly the language the automaton accepts.[src] Hence, the right-regular grammars generate exactly all regular languages.[src] The left-regular grammars describe the reverses of all such languages, that is, exactly the regular languages as well.[src] Every strict right-regular grammar is extended right-regular, while every extended right-regular grammar can be made strict by inserting new non-terminals, such that the result generates the same language; hence, extended right-regular grammars generate the regular languages as well.[src] Analogously, so do the extended left-regular grammars.[src] If empty productions are disallowed, only all regular languages that do not include the empty string can be generated.[src] While regular grammars can only describe regular languages, the converse is not true: regular languages can also be described by non-regular grammars.[src] ==Mixing left-regular and right-regular rules== If mixing of left-regular and right-regular rules is allowed, we still have a linear grammar, but not necessarily a regular one.[src] What is more, such a grammar need not generate a regular language: all linear grammars can be easily brought into this form, and hence, such grammars can generate exactly all linear languages, including non-regular ones.[src] For instance, the grammar G with N = {S, A}, Σ = {a, b}, P with start symbol S and rules S → aA A → Sb S → ε generates \{ a^ib^i : i \geq 0\} , the paradigmatic non-regular linear language.[src] ==See also== Regular expression, a compact notation for regular grammars Regular tree grammar, a generalization from strings to trees Prefix grammar Chomsky hierarchy Hidden Markov model ==Notes== ==References==[src]
21 sentences · 21 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Regular grammar." encyclopegia.org, 2026, https://encyclopegia.org/wiki/regular-grammar. Accessed 28 November 2026.
Chicago
"Regular grammar." encyclopegia.org. Accessed November 28, 2026. https://encyclopegia.org/wiki/regular-grammar.
APA
encyclopegia.org. (2026). Regular grammar. Retrieved November 28, 2026, from https://encyclopegia.org/wiki/regular-grammar
Accessed November 28, 2026 · CC BY-SA 4.0 · citation page · JSON