Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Regular grammar
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this 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: :{| |- || S β +A || A β 0A || B β 0C || C β 0C || D β +E || E β 0F || F β 0F |- || S β βA || A β 1A || B β 1C || C β 1C || D β βE || E β 1F || F β 1F |- || S β A || A β 2A || B β 2C || C β 2C || D β E || E β 2F || F β 2F |- || || A β 3A || B β 3C || C β 3C || || E β 3F || F β 3F |- || || A β 4A || B β 4C || C β 4C || || E β 4F || F β 4F |- || || A β 5A || B β 5C || C β 5C || || E β 5F || F β 5F |- || || A β 6A || B β 6C || C β 6C || || E β 6F || F β 6F |- || || A β 7A || B β 7C || C β 7C || || E β 7F || F β 7F |- || || A β 8A || B β 8C || C β 8C || || E β 8F || F β 8F |- || || A β 9A || B β 9C || C β 9C || || E β 9F || F β 9F |- || || A β .B || || C β eD || || || F β Ξ΅ |- || || A β B || || C β Ξ΅ || || || |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)