Regular grammar GudangMovies21 Rebahinxxi LK21

      In theoretical computer science and formal language theory, a regular grammar is a grammar that is right-regular or left-regular.
      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.
      Every regular grammar describes a regular language.


      Strictly regular grammars


      A right-regular grammar (also called right-linear grammar) is a formal grammar (N, Σ, P, S) in which all production rules in P are of one of the following forms:

      A → a
      A → aB
      A → ε
      where A, B, S ∈ N are non-terminal symbols, a ∈ Σ is a terminal symbol, and ε denotes the empty string, i.e. the string of length 0. S is called the start symbol.
      In a left-regular grammar, (also called left-linear grammar), all rules obey the forms

      A → a
      A → Ba
      A → ε
      The language described by a given grammar is the set of all strings that contain only terminal symbols and can be derived from the start symbol by repeated application of production rules. Two grammars are called weakly equivalent if they describe the same language.
      Rules of both kinds must not be mixed; for example, the grammar with rule set { S→aT, T→Sb, S→ε } is not regular, and describes the language



      {

      a

      i



      b

      i


      :
      i


      N

      }


      {\displaystyle \{a^{i}b^{i}:i\in \mathbb {N} \}}

      , which is not regular, either.
      Some textbooks and articles disallow empty production rules, and assume that the empty string is not present in languages.


      Extended regular grammars


      An extended right-regular grammar is one in which all rules obey one of

      A → w, where A is a non-terminal in N and w is in a (possibly empty) string of terminals Σ*
      A → wB, where A and B are in N and w is in Σ*.
      Some authors call this type of grammar a right-regular grammar (or right-linear grammar) and the type above a strictly right-regular grammar (or strictly right-linear grammar).
      An extended left-regular grammar is one in which all rules obey one of

      A → w, where A is a non-terminal in N and w is in Σ*
      A → Bw, where A and B are in N and w is in Σ*.


      Examples


      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*, viz. the set of all strings consisting of arbitrarily many "a"s, followed by a single "b", followed by arbitrarily many "c"s.
      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.
      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. Hence, the right-regular grammars generate exactly all regular languages. The left-regular grammars describe the reverses of all such languages, that is, exactly the regular languages as well.
      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. Analogously, so do the extended left-regular grammars.
      If empty productions are disallowed, only all regular languages that do not include the empty string can be generated.
      While regular grammars can only describe regular languages, the converse is not true: regular languages can also be described by non-regular grammars.


      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.
      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.
      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

      i



      b

      i


      :
      i

      0
      }


      {\displaystyle \{a^{i}b^{i}:i\geq 0\}}

      , the paradigmatic non-regular linear language.


      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


      References




      Further reading


      Perrin, Dominique (1990), "Finite Automata", in Leeuwen, Jan van (ed.), Formal Models and Semantics, Handbook of Theoretical Computer Science, vol. B, Elsevier, pp. 1–58
      Pin, Jean-Éric (Oct 2012). Mathematical Foundations of Automata Theory (PDF)., chapter III

    Kata Kunci Pencarian:

    regular grammarregular grammar to regular expressionregular grammar automataregular grammar meaningregular grammar to finite automataregular grammar to dfaregular grammar to nfaregular grammar exampleregular grammar generatorregular grammar vs cfg
    9-Regular Grammar | PDF | Metalogic | Grammar

    9-Regular Grammar | PDF | Metalogic | Grammar

    Regular Grammar - Coding Ninjas

    Regular Grammar - Coding Ninjas

    Regular Verbs: Explanation and Examples

    Regular Verbs: Explanation and Examples

    Regular grammar (Model regular grammars ) - GeeksforGeeks

    Regular grammar (Model regular grammars ) - GeeksforGeeks

    Regular grammar (Model regular grammars ) - GeeksforGeeks

    Regular grammar (Model regular grammars ) - GeeksforGeeks

    Solved Describe the difference between a regular grammar and | Chegg.com

    Solved Describe the difference between a regular grammar and | Chegg.com

    Different representations of regular grammar. | Download Scientific Diagram

    Different representations of regular grammar. | Download Scientific Diagram

    Regular Grammar in Discrete Mathematics - javatpoint

    Regular Grammar in Discrete Mathematics - javatpoint

    Regular Grammars What is a regular grammar The

    Regular Grammars What is a regular grammar The

    Regular Grammars What is a regular grammar The

    Regular Grammars What is a regular grammar The

    Regular Verbs, Definition and Examples - English Grammar Here

    Regular Verbs, Definition and Examples - English Grammar Here

    PPT - Regular Grammar and Regular Language [Def 3.1] Regular Grammar ...

    PPT - Regular Grammar and Regular Language [Def 3.1] Regular Grammar ...

    Search Results

    regular grammar

    Daftar Isi

    Regular grammar (Model regular grammars ) - GeeksforGeeks

    Apr 26, 2022 · Regular grammar is a type of grammar that describes a regular language. A regular grammar is a mathematical object, G, which consists of four components, G = (N, E, P, S), where N: non-empty, finite set of non-terminal symbols,E: a finite set of terminal symbols, or alphabet, symbols,P: a set of gra

    Regular grammar - Wikipedia

    In theoretical computer science and formal language theory, a regular grammar is a grammar that is right-regular or left-regular. While their exact definition varies from textbook to textbook, they all require that

    Regular Expressions, Regular Grammar and Regular Languages

    Jan 28, 2025 · Regular Grammar. A regular grammar is a formal grammar that generates regular languages. It consists of: Terminals: Symbols that form strings (e.g., a, b). Non-terminals: Variables used to derive strings (e.g., S, A). Production Rules: Rules for transforming non-terminals into terminals or other non-terminals.

    Right and Left linear Regular Grammars - GeeksforGeeks

    Nov 3, 2022 · Regular grammar is a type of grammar that describes a regular language. A regular grammar is a mathematical object, G, which consists of four components, G = (N, E, P, S), where N: non-empty, finite set of non-terminal symbols,E: a finite set of terminal symbols, or alphabet, symbols,P: a set of gra

    Regular vs Context Free Grammars - Stack Overflow

    Feb 18, 2009 · Regular grammar is either right or left linear, whereas context free grammar is basically any combination of terminals and non-terminals. Hence you can see that regular grammar is a subset of context-free grammar.

    Reading 17: Regular Expressions & Grammars - MIT

    Grammars and regular expressions are declarative specifications for strings and streams, which can be used directly by libraries and tools. These specifications are often simpler, more direct, and less likely to be buggy then parsing code written by hand.

    Formally Defining Regular Grammars - Montana State University

    Definition: Regular Grammar. A regular grammar is a mathematical object, G, with four components, G = (N, Σ, P, S), where. N is a nonempty, finite set of nonterminal symbols, Σ is a finite set of terminal symbols , or alphabet, symbols, P is a set of grammar rules, each of one having one of the forms A → aB; A → a

    Regular Grammars - Virginia Tech

    Nov 29, 2022 · Regular grammars are another way to describe regular languages. Recall that a grammar is made of of terminals, variables, and production rule. As the name implies, a regular grammar is a special type of grammar (we will see plenty of grammars later that are not regular).

    Regular Grammar - ODU

    A grammar is regular if and only if is a single nonterminal and is a single terminal or a single terminal followed by a single nonterminal, that is a production is of the form X -> a or X -> aY, where X and Y are nonterminals and a is a terminal.

    Regular Expressions, Regular Grammar and Regular Languages

    Regular expressions and regular grammars both have the same expressive power, representing the same set of languages. Regular expressions provide a more concise and readable way to represent patterns, while regular grammars offer a formal framework for understanding the structure of regular languages.