Update
This commit is contained in:
parent
82c02a1627
commit
72aebe3467
16 changed files with 68 additions and 35 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
The field of formal languages tries to [mathematically](math.md) and rigorously examine and describe anything that can be viewed as a language, which probably includes most structures we can think of, from human languages and computer languages to visual patterns and other highly abstract structures. Formal languages are at the root of theoretical [computer science](compsci.md) and are important e.g. for [computability](computability.md)/decidability, computational complexity, [security](security.md) and [compilers](compiler.md), but they also find use in linguistics and other fields of [science](science.md).
|
||||
|
||||
A **formal language** is defined as a (potentially infinite) set of strings over some alphabet (which is finite). I.e. a language is a subset of E* where E is a finite alphabet (a set of *letters*). (* is a *Kleene Star* and signifies a set of all possible strings over E). The string belonging to a language may be referred to as a *word* or perhaps even *sentence*, but this word/sentence is actually a whole kind of *text* written in the language, if we think of it in terms of our natural languages.
|
||||
A **formal language** is defined as a (potentially infinite) set of strings (which are finite but unlimited in length) over some alphabet (which is finite). I.e. a language is a subset of E* where E is a finite alphabet (a set of *letters*). (* is a *Kleene Star* and signifies a set of all possible strings over E). The string belonging to a language may be referred to as a *word* or perhaps even *sentence*, but this word/sentence is actually a whole kind of *text* written in the language, if we think of it in terms of our natural languages.
|
||||
|
||||
**For example**, given an alphabet [a,b,c], a possible formal language over it is [a,ab,bc,c]. Another, different possible language over this alphabet is an infinite language [b,ab,aab,aaab,aaaab,...] which we can also write with a [regular expression](regex.md) as a*b. We can also see e.g. English as being a formal language equivalent to a set of all texts over the English alphabet (along with symbols like space, dot, comma etc.) that we would consider to be in English as we speak it.
|
||||
|
||||
|
@ -20,4 +20,4 @@ We usually classify formal languages according to the **[Chomsky](chomsky.md) hi
|
|||
|
||||
Note that here we are basically always examining **infinite languages** as finite languages are trivial. If a language is finite (i.e. the set of all strings of the language is finite), it can automatically be computed by any type 3 computational model. In [real life](irl.md) computers are actually always equivalent to a finite state automaton, i.e. the *weakest* computational type (because a computer memory is always finite and so there is always a finite number of states a computer can be in). However this doesn't mean there is no point in studying infinite languages, of course, as we're still interested in the structure, computational methods and approximating the infinite models of computation.
|
||||
|
||||
**NOTE**: When trying to classify a [programming language](programming_language.md), we have to be careful about what we classify: one things is what a program written in given language can compute, and another thing is the language's [syntax](syntax.md). To the former all strict general-purpose programming languages such as [C](c.md) or [JavaScript](javascript.md) are type 0 ([Turing complete](turing_complete.md)). From the syntax point of view it's a bit more complicated and we need to further define what exactly a syntax is (where is the line between syntax and semantic errors): it may be (and often is) that syntactically the class will be lower. There is actually a famous [meme](meme.md) about [Perl](perl.md) syntax being undecidable.
|
||||
**NOTE**: When trying to classify a [programming language](programming_language.md), we have to be careful about what we classify: one thing is what a program written in given language can compute, and another thing is the language's [syntax](syntax.md). To the former all strict general-purpose programming languages such as [C](c.md) or [JavaScript](javascript.md) are type 0 ([Turing complete](turing_complete.md)). From the syntax point of view it's a bit more complicated and we need to further define what exactly a syntax is (where is the line between syntax and semantic errors): it may be (and often is) that syntactically the class will be lower. There is actually a famous [meme](meme.md) about [Perl](perl.md) syntax being undecidable.
|
Loading…
Add table
Add a link
Reference in a new issue