• Home
  • Queen's University
  • Software Specifications
  • DFA Minimization and Context-Free Grammars

DFA Minimization and Context-Free Grammars

CISC 223 - Assignment 4 (Winter 2014) Due: beginning of class (3:30 PM), Wednesday February 12 1. (4 marks) Using the algorithm mark distinguishable pairs of states that was presented in class (and can be found in the course notes), minimize the number of states of the DFA depicted in Figure 1. Figure 1: The DFA to be minimized in Question 1. Your answer should indicate in detail how you arrived at the solution: · For each stage of the algorithm, indicate which pair(s) of states are marked as dis- tinguishable and explain the reason why. · Draw the minimized state diagram where each state is labeled by the corresponding names of states in the original DFA that were merged together. 2. (2 marks) Give context-free grammars that generate the following languages: (a) {a2ib3k c4i | i ? 1, k ? 1} (b) {aªbkckai | i ? 1, k ? 1} 3. (4 marks) Consider the following context-free grammar <expr> -> <term> | <expr> + <term> <term> - > <factor> | <term> > <factor> <factor> > << expr>) | b Here <expr>, <term>, <factor> are nonterminals, <expr> is the start nonterminal and the set of terminals is {b, +, x, (, ) } . Using the general construction described on pages 218-219 draw a pushdown automaton that is equivalent to the above context-free grammar. Is your pushdown automaton deterministic or nondeterministic? Draw a table that traces the behavior of an accepting computation of your pushdown automaton on input (b+b) xb. The table should list the current state, currently remaining input, and current stack contents at each step of the computation. Regulations on assignments · The assignments may be done in groups consisting of one, two, three or four students. If more than one students are collaborating on an assignment, they must submit a single joint solution. . Clearly print (or type) the name(s) and student number(s), and course number, at the top of the first page. Additionally each student collaborating on an assignment must sign the top of the first page. · If the submission consists of more than one page, the pages must be stapled together. · Note: You are asked to write your solutions using non-erasable pen (or to type the solutions). Solutions written in pencil or erasable ink will be marked, but they will not be considered for remarking after the assignments are returned.