For faster navigation, this Iframe is preloading the Wikiwand page for 正規文法.

正規文法

正規文法(せいきぶんぽう、: regular grammar)は、形式文法における右正規文法(みぎせいきぶんぽう、: right-regular grammar)と左正規文法(ひだりせいきぶんぽう、: left-regular grammar)の総称。

右正規文法は、形式文法 (N, Σ, P, S) において P に含まれる生成規則が以下のような形式になっているものである。

  1. Aa
  2. AaB
  3. A → ε

ここで、ABSN非終端記号a ∈ Σ は終端記号、ε は空文字列S は開始記号である。

左正規文法は、生成規則が次の形式に従う。

  1. Aa
  2. ABa
  3. A → ε

[編集]

右正規文法 G の例を示す。G は、N = {S, A}、Σ = {a, b, c} から構成され、P には以下の規則がある。

SaS
SbA
A → ε
AcA

S は開始記号である。この文法を等価な正規表現で表すと a*bc* となる。

概要

[編集]

正規文法は全ての正規言語を記述することができ、そういう意味では有限オートマトン正規表現と等価である。さらに言えば、右正規文法も左正規文法も同じ正規言語を定義することができる。

正規文法は全て文脈自由文法に含まれる。

全ての文脈自由文法は、左正規規則と右正規規則の組み合わせに容易に変換可能である。つまり、右正規文法と左正規文法を合成することで全ての文脈自由言語を表現可能である。正規文法は左正規規則か右正規規則を使用するが、同時に両者を使用することはない。そのため、より狭い範囲の言語である正規言語だけを記述できる。

正規文法に空文字列(ε)を許さない場合もある。

関連項目

[編集]
{{bottomLinkPreText}} {{bottomLinkText}}
正規文法
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?