Update
This commit is contained in:
parent
dc1fe386df
commit
25bef6df75
10 changed files with 1741 additions and 1712 deletions
|
@ -10,7 +10,7 @@ A **formal language** is defined as a (potentially infinite) set of strings (whi
|
|||
|
||||
## Classification
|
||||
|
||||
We usually classify formal languages according to the **[Chomsky](chomsky.md) hierarchy**, by their computational "difficulty". Each level of the hierarchy has associated models of computation ([grammars](grammar.md), [automatons](automaton.md), ...) that are able to compute **all** languages of that level (remember that a level of the hierarchy is a superset of the levels below it and so also includes all the "simpler" languages). The hierarchy is more or less as follows:
|
||||
We usually classify formal languages according to the **[Chomsky](chomsky.md) hierarchy**, by their computational "difficulty". Each level of the hierarchy has associated models of computation ([grammars](grammar.md), [automatons](automaton.md), expressions, ...) that are able to compute **all** languages of that level (remember that a level of the hierarchy is a superset of the levels below it and so also includes all the "simpler" languages). The hierarchy is more or less as follows:
|
||||
|
||||
- **all languages**: This includes all possible languages, even those that computers cannot analyze (e.g. the language representing the [halting problem](halting_problem.md)). These languages can only be computed by theoretical computers that cannot physically exist in our universe.
|
||||
- **type 0**, **recursively enumerable languages**: Most "difficult"/general languages that computers in our universe can analyze. These languages can be computed e.g. by a **[Turing machine](turing_machine.md)**, [lambda calculus](lambda_calculus.md) or a general unrestricted [grammar](grammar.md). Example language: a^n where *n* is not a [prime](prime.md).
|
||||
|
@ -18,6 +18,8 @@ We usually classify formal languages according to the **[Chomsky](chomsky.md) hi
|
|||
- **type 2**, **context free languages**: Computed by e.g. non-deterministic pushdown automata or context free grammars. (Deterministic pushdown automata compute a class of languages that is between type 2 and type 3).
|
||||
- **type 3**, **regular languages**: The *easiest*, *weakest* kind of languages, computed e.g. by [finite state automata](finite_state_automaton.md)s or [regular expressions](regexp.md). This class includes also all finite languages.
|
||||
|
||||
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 that here we are basically always examining **[infinite](infinity.md) 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.
|
||||
|
||||
Also bear in mind these classes aren't exhaustive, there exist more classes and there are still undiscovered/unproven classes of languages, the Chomsky hierarchy enumerates just the important ones. For example regular languages have a further subclass of star-free languages.
|
||||
|
||||
**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