Check out my first novel, midnight's simulacra!
Theory: Difference between revisions
From dankwiki
Line 23: | Line 23: | ||
===Context-Sensitive Languages=== | ===Context-Sensitive Languages=== | ||
* Type 1 of the [[Chomsky Hierarchy]], a proper superset of | * Type 1 of the [[Chomsky Hierarchy]], a proper superset of CFLs | ||
* Recognized by linear bounded automata | * Recognized by linear bounded automata | ||
===Recursively-Enumerable Languages (Class [http://qwiki.stanford.edu/wiki/Complexity_Zoo:R#re RE])=== | ===Recursively-Enumerable Languages (Class [http://qwiki.stanford.edu/wiki/Complexity_Zoo:R#re RE])=== | ||
* Type 0 of the [[Chomsky Hierarchy]], a proper superset of | * Type 0 of the [[Chomsky Hierarchy]], a proper superset of CSLs | ||
* Recognized by [[Turing Machines]] (ie, any 'yes' answer can be verified, but 'no' cases might not halt) | * Recognized by [[Turing Machines]] (ie, any 'yes' answer can be verified, but 'no' cases might not halt) | ||
Revision as of 22:53, 9 October 2009
Formal Languages
Regular Languages (Class REG)
- Type 3 of the Chomsky Hierarchy (rewrite rules: A→a and A→aB)
- Nondeterminism (NFAs) adds no power to finite state automata (DFAs).
- Recognized by finite state machines. Equivalent to DSPACE(1).
- Closed under union, concatenation, Kleene, intersection, difference, complement, reverse, right-quotient, homomorphism
- Pumping lemma: A language L is regular if and only if there exists a positive integer m such that for any w ∈ L with |w| ≥ m there exist strings x, y and z such that:
- w = xyz,
- |xy| ≤ m,
- |y| ≥ 1, and
- xyiz ∈ L for all i ≥ 0
Context-Free Languages (CFLs) / Grammars (CFGs)
- Type 2 of the Chomsky Hierarchy, a proper superset of RLs
- Recognized by nondeterministic pushdown automata
- Deterministic pushdown automata (DPDAs) cannot recognize all CFLs (only the DCFLs)!
- Closed under union, concatenation, Kleene, reverse
- Not closed under complement or difference
- The intersection of an RL and CFL is a CFL, but CFLs are not closed under intersection
Efficiently-Parsed CFLs
- LL(n) (Lewis and Stearns, 1968):
- LR(n) (Knuth, 1965):
Context-Sensitive Languages
- Type 1 of the Chomsky Hierarchy, a proper superset of CFLs
- Recognized by linear bounded automata
Recursively-Enumerable Languages (Class RE)
- Type 0 of the Chomsky Hierarchy, a proper superset of CSLs
- Recognized by Turing Machines (ie, any 'yes' answer can be verified, but 'no' cases might not halt)
Recursive Languages (Class R)
- Decided by Turing Machines