{
  "translations": {
    "en": {
      "grammar": {
        "type": "multiple",
        "description": "One way to describe a language is in the form of a <b>grammar</b>. Below is a grammar that describes a really small subset of the English language.",
        "question":"What is a grammar?",
        "answer": "A way to describe languages",
        "choices": ["A way to describe languages", "A way to get the spelling right", "A way to arrange words in sentences"]
      },
      "production": {
        "type": "select",
        "description": "To the right of the arrow are one or more <b>productions</b>. Productions are separated by '|'.",
        "question": "The line with $\\lt d.o.\\gt$ to the left of the arrow has two productions associated with it. Which are they?",
        "answer": ["$\\lt article\\gt\\lt noun\\gt$", "$\\lt noun\\gt$"],
        "choices": ["$\\lt article\\gt\\lt noun\\gt$", "$\\lt noun\\gt$", "$\\lt d.o.\\gt$", "$\\lt subject\\gt$", "Fritz", "$\\lt article\\gt$", "$\\lt noun\\gt | \\lt noun\\gt$"],
        "incorrectFeedback": ["Look through the rules of the grammar, and find the one with $\\lt d.o.\\gt$ on the left. Now, what are the two productions on the right?"]
      },
      "terminal": {
        "type": "select",
        "description": "Any grammar has <b>variables</b> (also called <b>non-terminals</b>) and <b>terminals</b>. Terminals are generally strings. Variables are things that ultimately are replaced by terminals. In our example grammar, the variables are in brackets $\\lt \\gt$. (We won't always use brackets around variables for every example, though.) Terminals are things not in brackets $\\lt \\gt$.",
        "question": "Which of these are terminals?",
        "answer": ["a", "ball", "hit"],
        "choices": ["$\\lt noun\\gt$", "a", "ball", "$\\lt verb\\gt$", "hit"],
        "correctFeedback": ["Variables have brackets. Terminals do not."],
        "incorrectFeedback": ["Variables have brackets. Terminals do not."]
      },
      "nonterminal": {
        "type": "select",
        "description": "Any grammar has <b>variables</b> (also called <b>non-terminals</b>) and <b>terminals</b>. Terminals are generally strings. Variables are things that ultimately are replaced by terminals. In our example grammar, the variables are in brackets $\\lt \\gt$. (We won't always use brackets around variables for every example, though.) Terminals are things not in brackets $\\lt \\gt$.",
        "question": "Which of these are variables (non-terminals)?",
        "answer": ["$\\lt noun\\gt$", "$\\lt verb\\gt$"],
        "choices": ["$\\lt noun\\gt$", "a", "ball", "$\\lt verb\\gt$", "hit"],
        "correctFeedback": ["Variables have brackets. Terminals do not."],
        "incorrectFeedback": ["Variables have brackets. Terminals do not."]
      },
      "strings": {
        "type": "multiple",
        "description": "All grammars generate strings. In this example, the strings that are generated are sentences.",
        "question":"Is a sentence a string?",
        "answer": "Yes",
        "choices": ["Yes", "No"],
        "correctFeedback": ["This alphabet has letters and also includes the space symbol."],
        "incorrectFeedback": ["Why do you think that? Because it has spaces? A space is just a symbol, so the space symbol can be in an alphabet."]
      },
      "stringVsentence": {
        "type": "multiple",
        "description": "All grammars generate strings. In this example, the strings that are generated are sentences.",
        "question":"Which is correct?",
        "answer": "A sentence <b>is</b> a string.",
        "choices": ["A sentence <b>is</b> a string.", "A sentence is <b>made up of</b> strings."]
      },
      "start":{
        "type": "multiple",
        "description": "All strings in the language defined by the grammar are generated by starting with the variable on the left of the first rule in the list. In this example, that is the variable $\\lt sentence\\gt$. A given sentence is derived by using a series of replacements.",
        "question":"In this example, which variable must we start with?",
        "answer": "$\\lt sentence\\gt$",
        "choices": ["$\\lt sentence\\gt$", "$\\lt subject\\gt$", "$\\lt verb\\gt$", "$\\lt d.o.\\gt$", "$\\lt article\\gt$", "$\\lt noun\\gt$"]
      },
      "sentence": {
        "type": "multiple",
        "description": "You can form only certain sentences using the grammar. The set of sentences that the grammar will let you form define the language associated with the grammar.",
        "question": "Which one of these sentences belongs to this language?",
        "answer": "the ball hit the Fritz",
        "choices": ["the hit ball Fritz", "the ball hit the Fritz", "the Fritz hit ran", "ran Fritz"],
        "correctFeedback": ["See if you can determine which series of productions were used to generate this sentence when starting at $\\lt sentence\\gt$."],
        "incorrectFeedback": ["There is no way to start with $\\lt sentence\\gt$ and replace each variable through production rules to reach this sentence."]
      },
      "first":{
        "type": "multiple",
        "description": "We are now going to show how to <b>derive</b> a sentence from the grammar, beginning with the start variable and using a series of productions. We will use the target sentence 'Fritz hit the ball'. The first step is to replace $\\lt sentence\\gt$ with the only production available: $\\lt subject\\gt\\lt verb\\gt\\lt d.o.\\gt$. The next steps will replace these variables in turn.",
        "question":"What is the substitute for $\\lt subject\\gt$ to derive the sentence ‘Fritz hit the ball’?",
        "answer": "$\\lt noun\\gt$",
        "choices": ["$\\lt sentence\\gt$", "$\\lt noun\\gt$", "$\\lt article\\gt$", "$\\lt article\\gt\\lt noun\\gt$", "Fritz"],
        "correctFeedback": ["$\\lt subject\\gt$ has two productions to chose from, but only one of them can lead to a sentence that starts with 'Fritz'."]
      },
      "Fritz":{
        "type": "multiple",
        "description": "We used the symbol $\\rightarrow$ to indicate that a substitution takes place. So far, we have $\\lt sentence\\gt\\ \\rightarrow\\ \\lt subject\\gt\\lt verb\\gt\\lt d.o.\\gt\\ \\rightarrow\\ \\lt noun\\gt\\lt verb\\gt\\lt d.o.\\gt$.",
        "question": "What is the substitute for $\\lt noun\\gt$ to derive the sentence 'Fritz hit the ball'?",
        "answer": "Fritz",
        "choices": ["$\\lt sentence\\gt$", "$\\lt noun\\gt$", "$\\lt article\\gt$", "$\\lt article\\gt\\lt noun\\gt$", "Fritz"]
      },
      "verb":{
        "type": "multiple",
        "description": "Now we have 'Fritz $\\lt verb\\gt\\lt d.o.\\gt$'. Continue substituting variables.",
        "question":"What is the substitute for $\\lt verb\\gt$ to derive the sentence 'Fritz hit the ball'?",
        "answer": "hit",
        "choices": ["hit", "ran", "ate", "ball", "the"]
      },
      "do":{
        "type": "multiple",
        "description": "Now we have 'Fritz hit $\\lt d.o.\\gt$'. Continue substituting variables.",
        "question":"What is the substitute for $\\lt d.o.\\gt$ to continue deriving the sentence 'Fritz hit the ball'?",
        "answer": "$\\lt article\\gt\\lt noun\\gt$",
        "choices": ["$\\lt article\\gt\\lt noun\\gt$", "$\\lt noun\\gt$", "the", "ball", "the ball"]
      },
      "article":{
        "type": "multiple",
        "description": "Now we have 'Fritz hit $\\lt article\\gt\\lt noun\\gt$'. Continue substituting variables.",
        "question":"What is the substitute for $\\lt article\\gt$ to derive the sentence 'Fritz hit the ball'?",
        "answer": "the",
        "choices": ["the", "ate", "ball", "the ball", "an"]
      },
      "noun":{
        "type": "multiple",
        "description": "Last step! Now we have 'Fritz hit the $\\lt noun\\gt$'.",
        "question":"What is the substitute for $\\lt noun\\gt$ to derive the sentence `Fritz hit the ball'?",
        "answer": "ball",
        "choices": ["ran", "ate", "ball", "Fritz", "a"]
      },
      "bad":{
        "type": "multiple",
        "description": "The final derivation is:<br/> $\\lt sentence\\gt\\ \\rightarrow\\ \\lt subject\\gt\\lt verb\\gt\\lt d.o.\\gt\\ \\rightarrow$<br/>$\\lt noun\\gt\\lt verb\\gt\\lt d.o.\\gt\\ \\rightarrow\\ $ Fritz $\\lt verb\\gt\\lt d.o.\\gt\\ \\rightarrow\\ $<br/>Fritz hit $\\lt d.o.\\gt\\ \\rightarrow\\ $ Fritz hit $\\lt article\\gt\\lt noun\\gt\\ \\rightarrow\\ $<br/>Fritz hit the $\\lt noun\\gt\\ \\rightarrow\\ $ Fritz hit the ball",
        "question":"Can we derive these two sentences? 'The ball hit Fritz' or 'The ball ate the ball'?",
        "answer":"Yes",
        "choices": ["Yes", "No"],
        "correctFeedback": ["This is a very simple grammar. Not all of the sentences that can be generated necessary make sense to us as meaningful in English."]
      },
      "syntax":{
        "type": "multiple",
        "description": "The reason why we can derive “The ball hit Fritz”, and “The ball ate the ball” is that grammars only focus on the correct <b>syntax</b>. This is an important distinction.",
        "question":"Can grammars generate sentences with bad <b>semantics</b>? (That is, can they seem meaningless?)",
        "answer":"Yes",
        "choices": ["Yes", "No"]
      },
      "leftside":{
        "type": "select",
        "description": "The formal definition for a grammar is $G = (V, T, S, P)$ where $V$ is a finite set of variables (non-terminals), $T$ is a finite set of terminals (these are strings), $S$ is the start variable $(S \\in V$), and $P$ is a set of productions (rules) of the form $x \\rightarrow y$. This means to replace $x$ by $y$.",
        "question":"In $x \\rightarrow y$, what does $x$ represent?",
        "answer":["Variables", "Terminals"],
        "choices": ["Variables", "Terminals"],
        "correctFeedback": ["It might seem strange that $x$ can include both variables and terminals. But we will see later on that certain types of grammars can be quite flexible, and permit multiple variables or even include terminals on the left side of its rules."]
      },
      "rightside":{
        "type": "select",
        "description": "The formal definition for a grammar is $G = (V, T, S, P)$ where $V$ is a finite set of variables (non-terminals), $T$ is a finite set of terminals (these are strings), $S$ is the start variable $(S \\in V$), and $P$ is a set of productions (rules) of the form $x \\rightarrow y$. This means to replace $x$ by $y$.",
        "question":"What does $y$ represent?",
        "answer":["Variables", "Terminals"],
        "choices": ["Variables", "Terminals"],
        "correctFeedback": ["It should be no surprise that the right-hand side of a production can contain a mix of variables and terminals."]
      },
      "parts":{
        "type": "select",
        "description": "What is the language of the grammar? Answer: It is all strings formed from the set of terminals ($T^∗$ is all possible strings over $T$), such that if you start with $S$ (the start symbol for the grammar), then you can derive the string. 'Derive the string' means that you can make a series of steps where each step uses a production rules to replace what is on the left of a rule with one of the substitutions allowed by the right of that rule.",
        "question":"Consider the grammar: $G = (\\{S\\},\\ \\{a,b\\},\\ S,\\ P)$, where $P=\\{S \\rightarrow aaS,\\ S \\rightarrow b\\}$. What is $S$?",
        "answer":["Start Variable", "Variable"],
        "choices": ["Variable", "Terminal", "Start Variable", "Grammar Production Rule"],
        "incorrectFeedback": ["Check all that apply."]
      },
      "parts2":{
        "type": "select",
        "description": "What is the language of the grammar? Answer: It is all strings formed from the set of terminals ($T^∗$ is all possible strings over $T$), such that if you start with $S$ (the start symbol for the grammar), then you can derive the string. 'Derive the string' means that you can make a series of steps where each step uses a production rules to replace what is on the left of a rule with one of the substitutions allowed by the right of that rule.",
        "question":"Consider the grammar: $G = (\\{S\\},\\ \\{a, b\\},\\ S,\\ P)$, where $P=\\{S \\rightarrow aaS,\\ S \\rightarrow b\\}$. What is $\\{a, b\\}$?",
        "answer":["Terminals"],
        "choices": ["Variables", "Terminals", "Start Variable", "Grammar Production Rules"]
      },
      "LG":{
        "type": "select",
        "description": "What is the language of the grammar? Answer: It is all strings formed from the set of terminals ($T^∗$ is all possible strings over $T$), such that if you start with $S$ (the start symbol for the grammar), then you can derive the string. 'Derive the string' means that you can make a series of steps where each step uses a production rules to replace what is on the left of a rule with one of the substitutions allowed by the right of that rule.",
        "question":"Consider the grammar: $G = (\\{S\\},\\ \\{a, b\\},\\ S,\\ P)$, where $P=\\{S \\rightarrow aaS,\\ S \\rightarrow b\\}$. What does $L(G)$ mean?",
        "answer":["The language represented by the grammar"],
        "choices": ["The language represented by the grammar", "The grammar"]
      },
      "G":{
        "type": "select",
        "description": "What is the language of the grammar? Answer: It is all strings formed from the set of terminals ($T^∗$ is all possible strings over $T$), such that if you start with $S$ (the start symbol for the grammar), then you can derive the string. 'Derive the string' means that you can make a series of steps where each step uses a production rules to replace what is on the left of a rule with one of the substitutions allowed by the right of that rule.",
        "question":"Consider the grammar: $G = (\\{S\\},\\ \\{a, b\\},\\ S,\\ P)$, where $P=\\{S \\rightarrow aaS,\\ S \\rightarrow b\\}$. What is $G$?",
        "answer":["The grammar"],
        "choices": ["The language represented by the grammar", "The grammar"]
      },
      "LGlist":{
        "type": "select",
        "description": "What is the language of the grammar? Answer: It is all strings formed from the set of terminals ($T^∗$ is all possible strings over $T$), such that if you start with $S$ (the start symbol for the grammar), then you can derive the string. 'Derive the string' means that you can make a series of steps where each step uses a production rules to replace what is on the left of a rule with one of the substitutions allowed by the right of that rule.",
        "question":"Consider the grammar: $G = (\\{S\\},\\ \\{a, b\\},\\ S,\\ P)$, where $P=\\{S \\rightarrow aaS,\\ S \\rightarrow b\\}$. What is $L(G)$?",
        "answer":["$\\{b, aab, aaaab, ... \\} = \\{(aa)^nb\\ |\\ n \\ge 0\\}$"],
        "choices": ["$\\{b, aab, aaaab, ... \\} = \\{(aa)^nb\\ |\\ n \\ge 0\\}$", "$\\{ab, aaab, aaaaab, ... \\} = \\{a(aa)^nb\\ |\\ n \\ge 0\\}$", "$\\{bb, aabb, aaaabb, ... \\} = \\{(aa)^nbb\\ |\\ n \\ge 0\\}$"]
      },
      "whichrules":{
        "type": "select",
        "description": "What is the language of the grammar? Answer: It is all strings formed from the set of terminals ($T^∗$ is all possible strings over $T$), such that if you start with $S$ (the start symbol for the grammar), then you can derive the string. 'Derive the string' means that you can make a series of steps where each step uses a production rules to replace what is on the left of a rule with one of the substitutions allowed by the right of that rule.",
        "question":"Consider $L(G) = \\{a^nccb^n\\ |\\ n > 0\\}$. Which of the following sets of productions rules derive $L(G)$?",
        "answer": ["$P = \\{S \\rightarrow aSb\\ |\\ aAb,\\ A \\rightarrow cc\\}$", "$P = \\{S \\rightarrow aSb\\ |\\ accb\\}$", "$P = \\{S \\rightarrow aSb\\ |\\ B,\\ B \\rightarrow aAb,\\ A \\rightarrow cc\\}$"],
        "choices": ["$P = \\{S \\rightarrow aSb\\ |\\ aAb,\\ A \\rightarrow cc\\}$", "$P = \\{S \\rightarrow aSb\\ |\\ accb\\}$", "$P = \\{S \\rightarrow aSb\\ |\\ B,\\ B \\rightarrow aAb,\\ A \\rightarrow cc\\}$"],
        "incorrectFeedback": ["Check all that apply."]
      },
      "pickstrings":{
        "type": "select",
        "description": "What is the language of the grammar? Answer: It is all strings formed from the set of terminals ($T^∗$ is all possible strings over $T$), such that if you start with $S$ (the start symbol for the grammar), then you can derive the string. 'Derive the string' means that you can make a series of steps where each step uses a production rules to replace what is on the left of a rule with one of the substitutions allowed by the right of that rule.",
        "question":"Consider grammar $G = (\\{S\\},\\ \\{a,b\\},\\ S,\\ P)$, where $P = \\{S \\rightarrow aSb,\\ S \\rightarrow SS,\\ S \\rightarrow ab\\}$. Which of the following strings are in $L(G)$?",
        "answer":["$aabb$", "$abab$"],
        "choices": ["$aabb$", "$abab$", "$abba$", "$babab$"]
      },
      "whatlang":{
        "type": "multiple",
        "description": "What is the language of the grammar? Answer: It is all strings formed from the set of terminals ($T^∗$ is all possible strings over $T$), such that if you start with $S$ (the start symbol for the grammar), then you can derive the string. 'Derive the string' means that you can make a series of steps where each step uses a production rules to replace what is on the left of a rule with one of the substitutions allowed by the right of that rule.",
        "question":"Consider grammar $G = (\\{S\\},\\ \\{(, )\\},\\ S,\\ P)$, where $P = \\{S \\rightarrow (S),\\ S \\rightarrow SS,\\ S \\rightarrow ()\\}$.<br/>[T/F] This grammar represents the language of matching parentheses.",
        "answer":["True"],
        "choices": ["True", "False"]
      }
    }
  }
}
