Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Formal language
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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== The following rules describe a formal language {{mvar|L}} over the alphabet Ξ£ = {0,β1,β2,β3,β4,β5,β6,β7,β8,β9,β+,β=}: * Every nonempty string that does not contain "+" or "=" and does not start with "0" is in {{mvar|L}}. * The string "0" is in {{mvar|L}}. * A string containing "=" is in {{mvar|L}} if and only if there is exactly one "=", and it separates two valid strings of {{mvar|L}}. * A string containing "+" but not "=" is in {{mvar|L}} if and only if every "+" in the string separates two valid strings of {{mvar|L}}. * No string is in {{mvar|L}} other than those implied by the previous rules. Under these rules, the string "23+4=555" is in {{mvar|L}}, but the string "=234=+" is not. This formal language expresses [[natural number]]s, well-formed additions, and well-formed addition equalities, but it expresses only what they look like (their [[syntax]]), not what they mean ([[semantics]]). For instance, nowhere in these rules is there any indication that "0" means the number zero, "+" means addition, "23+4=555" is false, etc. === Constructions ===<!-- [[empty language]] redirects here --> For finite languages, one can explicitly enumerate all well-formed words. For example, we can describe a language {{mvar|L}} as just {{mvar|L}} = {a,βb,βab,βcba}. The [[degeneracy (mathematics)|degenerate]] case of this construction is the '''empty language''', which contains no words at all (<span class="nounderlines">{{mvar|L}} = [[β ]]</span>). However, even over a finite (non-empty) alphabet such as Ξ£ = {a, b} there are an infinite number of finite-length words that can potentially be expressed: "a", "abb", "ababba", "aaababbbbaab", .... Therefore, formal languages are typically infinite, and describing an infinite formal language is not as simple as writing ''L'' = {a,βb,βab,βcba}. Here are some examples of formal languages: * {{mvar|L}} = Ξ£<sup>*</sup>, the set of ''all'' words over Ξ£; * {{mvar|L}} = {a}<sup>*</sup> = {a<sup>''n''</sup>}, where ''n'' ranges over the natural numbers and "a<sup>''n''</sup>" means "a" repeated ''n'' times (this is the set of words consisting only of the symbol "a"); * the set of syntactically correct programs in a given programming language (the syntax of which is usually defined by a [[context-free grammar]]); * the set of inputs upon which a certain [[Turing machine]] halts; or * the set of maximal strings of [[alphanumeric]] [[ASCII]] characters on this line, i.e.,<br> the set {the, set, of, maximal, strings, alphanumeric, ASCII, characters, on, this, line, i, e}.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Formal language
(section)
Add topic