{
  "translations": {
    "en": {
      "a":{
        "type": "select",
        "description": "<b>Definition:</b> A CFG is in Greibach normal form (GNF) if all productions are of the form<br/>$A \\rightarrow ax$<br/>where $x \\in V^*$ and $a \\in T$",
        "question": "What do we mean by $a$?",
        "answer": "Single terminal",
        "choices": ["Single terminal", "Zero or more terminals", "Single variable", "Zero or more variables"]
      },
      "x":{
        "type": "select",
        "description": "<b>Definition:</b> A CFG is in Greibach normal form (GNF) if all productions are of the form<br/>$A \\rightarrow ax$<br/>where $x \\in V^*$ and $a \\in T$",
        "question": "What do we mean by $x$?",
        "answer": "Zero or more variables",
        "choices": ["Single terminal", "Zero or more terminals", "Single variable", "Zero or more variables"]
      },
      "sgram":{
        "type": "select",
        "description": "$<b>Definition:</b> A CFG is in Greibach normal form (GNF) if all productions are of the form<br/>$A \\rightarrow ax$<br/>where $x \\in V^*$ and $a \\in T$",
        "question": "Earlier we saw a similar type of grammar where every production starts with a single $\\textbf{unique}$ terminal. This is called a:",
        "answer": "S-Grammar or Simple-Grammar",
        "choices": ["CFG", "S-Grammar or Simple-Grammar", "Linear Grammar", "Regular Grammar"]
      },
      "derive":{
        "type": "true/false",
        "description": "<b>Definition:</b> A CFG is in Greibach normal form (GNF) if all productions are of the form<br/>$A \\rightarrow ax$<br/>where $x \\in V^*$ and $a \\in T$",
        "question": "The benifit of having a terminal in the first position of every production is that you wouldn’t have to backtrack during dervivation (there is only one choice to match the derivation of a string).",
        "answer": "True",
        "choices": []
      },
      "cnf":{
        "type": "true/false",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>1. Rewrite grammar in CNF.",
        "question": "CNF is an abbreviation for Chomsky Normal Form.",
        "answer": "True",
        "choices": []
      },
      "whichcnf":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>1. Rewrite grammar in CNF.",
        "question": "Which of the following productions are in CNF?",
        "answer": ["$S \\rightarrow a$", "$S \\rightarrow BC$"],
        "choices": ["$S \\rightarrow \\lambda$", "$S \\rightarrow a$", "$S \\rightarrow A$", "$S \\rightarrow BC$", "$S \\rightarrow aBC$"],
        "incorrectFeedback":["CNF includes only productions of the form $A \\rightarrow BC$ or $A \\rightarrow a$."]
      },
      "cnfdef":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>1. Rewrite grammar in CNF.",
        "question": "Being in CNF means that the grammar must have no ...",
        "answer": ["unit productions", "useless productions", "$\\lambda$-productions"],
        "choices": ["unit productions", "useless productions", "$\\lambda$-productions"]
      },
      "notincnf":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>1. Rewrite grammar in CNF.",
        "question": "Consider the grammar on the left. Is it in CNF?",
        "answer": "No",
        "choices": ["Yes", "No"]
      },
      "incnf":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>1. Rewrite grammar in CNF.",
        "question": "Consider this revised version of the grammar on the left. Is this grammar now in CNF?",
        "answer": "Yes",
        "choices": ["Yes", "No"]
      },
      "leftrecur":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>1. Rewrite grammar in CNF.<br/>2. Relabel Variables $A_1, A_2, \\ldots A_n$<br/>3. Eliminate left recursion and substitute to get productions into the form:<br/>$\\quad A_i \\rightarrow A_jX_j,\\ j > i$<br/>$\\quad Z_i \\rightarrow A_jX_j,\\ j \\le n$<br/>$\\quad A_i \\rightarrow aX_i$,<br/>$a\\in T$, $X_i \\in V^*$, and variables $Z_i$ are introduced when needed to remove left recursion.",
        "question": "Left recursion means that a variable has a production like $A \\rightarrow Ax$. Does this grammar contain left recursion?",
        "answer": "No",
        "choices": ["Yes", "No"]
      },
      "a5":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>3. Eliminate left recursion and substitute to get productions into the form:<br/>$\\quad A_i \\rightarrow A_jX_j,\\ j > i$<br/>$\\quad Z_i \\rightarrow A_jX_j,\\ j \\le n$<br/>$\\quad A_i \\rightarrow aX_i$,<br/>$a\\in T$, $X_i \\in V^*$, and variables $Z_i$ are introduced when needed to remove left recursion. All productions with $A_n$ are in the correct form, $A_n \\rightarrow ax_n$. Use these productions as substitutions to get $A_{n−1}$ productions in the correct form. Repeat with $A_{n−2}$, $A_{n−3}$, etc until all productions are in the correct form.",
        "question": "Look at the right hand side of all productions. We need to pick a variable with the largest index that begins a RHS. Which variable should we start with?",
        "answer": "$A_5$",
        "choices": ["$A_1$", "$A_2$", "$A_3$", "$A_4$", "$A_5$", "$A_6$"],
        "incorrectFeedback": ["Is this the largest index for a variable that begins a RHS?"]
      },
      "a2":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>3. Eliminate left recursion and substitute to get productions into the form:<br/>$\\quad A_i \\rightarrow A_jX_j,\\ j > i$<br/>$\\quad Z_i \\rightarrow A_jX_j,\\ j \\le n$<br/>$\\quad A_i \\rightarrow aX_i$,<br/>$a\\in T$, $X_i \\in V^*$, and variables $Z_i$ are introduced when needed to remove left recursion. All productions with $A_n$ are in the correct form, $A_n \\rightarrow ax_n$. Use these productions as substitutions to get $A_{n−1}$ productions in the correct form. Repeat with $A_{n−2}$, $A_{n−3}$, etc until all productions are in the correct form.",
        "question": "Notice that we replaced $A_2 \\rightarrow A_5A_2$ with $A_2 \\rightarrow cA_2$ by substituting $c$ for $A_5$.<br/><br/>Now look at the right hand side of all productions, which variable we use next to substitute in remaining productions?",
        "answer": "$A_2$",
        "choices": ["$A_1$", "$A_2$", "$A_3$", "$A_4$", "$A_5$", "$A_6$"]
      },
      "a1":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>3. Eliminate left recursion and substitute to get productions into the form:<br/>$\\quad A_i \\rightarrow A_jX_j,\\ j > i$<br/>$\\quad Z_i \\rightarrow A_jX_j,\\ j \\le n$<br/>$\\quad A_i \\rightarrow aX_i$,<br/>$a\\in T$, $X_i \\in V^*$, and variables $Z_i$ are introduced when needed to remove left recursion. All productions with $A_n$ are in the correct form, $A_n \\rightarrow ax_n$. Use these productions as substitutions to get $A_{n−1}$ productions in the correct form. Repeat with $A_{n−2}$, $A_{n−3}$, etc until all productions are in the correct form.",
        "question": "How should we replace the highlighted production?",
        "answer": ["$A_1 \\rightarrow cA_3$", "$A_1 \\rightarrow cA_2A_3$"],
        "choices": ["$A_1 \\rightarrow cA_3$", "$A_1 \\rightarrow cA_2A_3$", "$A_1 \\rightarrow cA_3$"]
      },
      "a1b":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>3. Eliminate left recursion and substitute to get productions into the form:<br/>$\\quad A_i \\rightarrow A_jX_j,\\ j > i$<br/>$\\quad Z_i \\rightarrow A_jX_j,\\ j \\le n$<br/>$\\quad A_i \\rightarrow aX_i$,<br/>$a\\in T$, $X_i \\in V^*$, and variables $Z_i$ are introduced when needed to remove left recursion. All productions with $A_n$ are in the correct form, $A_n \\rightarrow ax_n$. Use these productions as substitutions to get $A_{n−1}$ productions in the correct form. Repeat with $A_{n−2}$, $A_{n−3}$, etc until all productions are in the correct form.",
        "question": "How should we replace the highlighted production?",
        "answer": ["$A_1 \\rightarrow cA_4$", "$A_1 \\rightarrow cA_2A_4$"],
        "choices": ["$A_1 \\rightarrow cA_4$", "$A_1 \\rightarrow cA_2A_4$", "$A_1 \\rightarrow cA_2$"]
      },
      "a3":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>3. Eliminate left recursion and substitute to get productions into the form:<br/>$\\quad A_i \\rightarrow A_jX_j,\\ j > i$<br/>$\\quad Z_i \\rightarrow A_jX_j,\\ j \\le n$<br/>$\\quad A_i \\rightarrow aX_i$,<br/>$a\\in T$, $X_i \\in V^*$, and variables $Z_i$ are introduced when needed to remove left recursion. All productions with $A_n$ are in the correct form, $A_n \\rightarrow ax_n$. Use these productions as substitutions to get $A_{n−1}$ productions in the correct form. Repeat with $A_{n−2}$, $A_{n−3}$, etc until all productions are in the correct form.",
        "question": "How should we replace the highlighted production?",
        "answer": ["$A_3 \\rightarrow cA_6$", "$A_3 \\rightarrow cA_2A_6$"],
        "choices": ["$A_3 \\rightarrow cA_6$", "$A_3 \\rightarrow cA_2A_6$", "$A_3 \\rightarrow cA_2$"]
      },
      "done":{
        "type": "select",
        "description": "<b>Theorem:</b> For every CFG $G$ with $\\lambda$ not in L(G), $\\exists$ a grammar in GNF.<br/>3. Eliminate left recursion and substitute to get productions into the form:<br/>$\\quad A_i \\rightarrow A_jX_j,\\ j > i$<br/>$\\quad Z_i \\rightarrow A_jX_j,\\ j \\le n$<br/>$\\quad A_i \\rightarrow aX_i$,<br/>$a\\in T$, $X_i \\in V^*$, and variables $Z_i$ are introduced when needed to remove left recursion. All productions with $A_n$ are in the correct form, $A_n \\rightarrow ax_n$. Use these productions as substitutions to get $A_{n−1}$ productions in the correct form. Repeat with $A_{n−2}$, $A_{n−3}$, etc until all productions are in the correct form.",
        "question": "Are we done?",
        "answer": "Yes",
        "choices": ["Yes", "No"]
      }
    }
  }
}
