Presentation is loading. Please wait.

Presentation is loading. Please wait.

DETERMINISTIC CONTEXT FREE LANGUAGES

Similar presentations


Presentation on theme: "DETERMINISTIC CONTEXT FREE LANGUAGES"— Presentation transcript:

1 DETERMINISTIC CONTEXT FREE LANGUAGES
Ethakota Krishnamurthi Surendranath Manoj Gujjari

2 What is a CFL(Context Free Language)?
Deterministic Context Free Language Description Properties Importance

3 CONTEXT FREE LANGUAGES
A context-free language (CFL) is a language generated by some context-free grammar (CFG). Different CF grammars can generate the same CF language, or conversely, a given CF language can be generated by different CF grammars. The class of context-free languages generalizes the class of regular languages, i.e., every regular language is a context-free language. The reverse of this is not true, i.e., every context-free language is not necessarily regular.

4 DCFL Deterministic context-free languages are a proper subset of context-free languages. Context free languages that can be accepted by Deterministic Push-Down Automata. DCFLs are always unambiguous. Many programming languages can be described by means of DCFLs.

5 DCFL Description Consider $: end of string marker Consider an example:
Let L = a*  {anbn : n > 0}. When it begins reading a’s, M must push them onto the stack. In case there are going to be b’s it runs out of input without seeing b’s, it needs a way to pop the a’s from the stack before it can accept. The end-of-string marker allows the popping to happen, when all the input has been read. Add $ to make it easier to build DPDAs, it does not add power (to allow building a PDA for L that was not context-free) There exist CLFs that are not deterministic, e.g., L = {aibjck, i  j or j  k}.

6 A DETERMINISTIC PDA FOR L
L = a*  {anbn : n > 0}.

7 A NDPDA FOR L( No end-marker)
L = a*  {anbn : n > 0}.

8 Properties of DCFL DCFLS are not closed under union.
DCFLS are not closed under intersection. DCFLS are closed under complement.

9 DCFLS are not closed under UNION
L1 = {aibjck, i, j, k  0 and i  j}. (a DCFL) L2 = {aibjck, i, j, k  0 and j  k}. (a DCFL) L = L1  L2. = {aibjck, i, j, k  0 and (i  j) or (j  k)}. L = L. = {aibjck, i, j, k  0 and i = j = k}  {w  {a, b, c}* : the letters are out of order}. L = L  a*b*c*. = {anbncn, n 0}. L is not even CF, much less DCF.

10 DCFLS are not closed under Intersection
L1 = {aibjck, i, j, k  0 and i = j}. L2 = {aibjck, i, j, k  0 and j = k}. L = L1  L2 = L1 and L2 are deterministic context-free:

11 CFL HIERARCHY

12 References Automata, Computability and Complexity, Elaine Rich.

13 QUESTIONS?


Download ppt "DETERMINISTIC CONTEXT FREE LANGUAGES"

Similar presentations


Ads by Google