Question

In: Math

Draw a parse tree for the string “big Jim ate green cheese” in ? = (?,...

Draw a parse tree for the string “big Jim ate green cheese” in ? = (?, ∑, ?, ?, ), where: ? = {?, ?, ?, ?, ?} ∪ ∑ , ∑ = {???, ???, ?????, ?ℎ????, ???}, ? = {? → ?, ? → ??, ? → ???, ? → ???, ? → ?????, ? → ?ℎ????, ? → ???, ? → ???}.

Solutions

Expert Solution

Given that ? = (?, ∑, ?, ?, ), where: ? = {?, ?, ?, ?, ?} ∪ ∑ , ∑ = {???, ???, ?????, ?ℎ????, ???}, ? = {? → ?, ? → ??, ? → ???, ? → ???, ? → ?????, ? → ?ℎ????, ? → ???, ? → ???}

S={S} i.e. S is the start symbol.

Each production is in the form of Aàα   where α € (?, ∑)*

Hence the given grammar is context free grammar.

Now we need construct a parse tree for the string “big Jim ate green cheese”

left most derivation of the given string:

            S-->P V P

-->A P V P                             (using P-->AP)

-->big P V P                           (using A-->big)

-->big N V P                           (using P-->N)

-->big Jim V P                        (using N-->Jim)

-->big Jim ate P                     (using V-->ate)

-->big Jim ate A P                 (using P-->AP)

-->big Jim ate green P          (using A-->green)    

-->big Jim ate green N         (using P-->N)

-->big Jim ate green cheese           (using N-->cheese)

Hence the given string is derived.

parse tree:

NOTE; if u have any doubt pls ask me i will answer u again as my level best


Related Solutions

1. Draw a binary search tree as a single root node holding a string as the...
1. Draw a binary search tree as a single root node holding a string as the data element. Each string inserted into a node in the tree will be for a character in a game. Then, draw a new tree each time you insert a new node into the tree holding a string Insert 4 nodes total, including the root. This means the new nodes will need to be inserted at the correct child to maintain the BST property.
create your own function that wraps it with try catch. Pass in the string to parse,...
create your own function that wraps it with try catch. Pass in the string to parse, and the name of the field, put some logging in the catch How do I do this? say with this code segment? void readStudents() { //Scanner class object declare Scanner readStudentFile = null; //try block begin try { //open file readStudentFile = new Scanner(new File(".\\src\\test\\student.txt")); //loop until end of file while(readStudentFile.hasNextLine()) { String stu = readStudentFile.nextLine(); String[] eachStu; eachStu = stu.split(" "); students.add(new Student(eachStu[0],...
Convert the simple algebra below into Chomsky Normal Form (CNF), and then create a parse tree...
Convert the simple algebra below into Chomsky Normal Form (CNF), and then create a parse tree showing how the converted grammar could derive: x + y * z E → E + T | T T → T * F | F F → (E) | x | y | z
Parse string java code Write a recursive program that can calculate the value of a given...
Parse string java code Write a recursive program that can calculate the value of a given polynomial in a string, which is not more than the tenth order, for the given x. The polynomial will be given in the following format and should display the value of the polynomial for spaced-out x Using index of for -/+
So I need to parse tweets with the String class and I have no idea what...
So I need to parse tweets with the String class and I have no idea what should I do for this lab and how to start my coding. It will be nice if anyone guide me what should I do exactly and how I start this lab. Use the Scanner class (as discussed in lecture) to read in a tweet entered by the user and store it in a String variable named tweet. You will be splitting up (parsing) the...
One common use of this class is to parse comma-separated integers from a string (e.g., "23,4,56")....
One common use of this class is to parse comma-separated integers from a string (e.g., "23,4,56"). stringstream ss("23,4,56"); char ch; int a, b, c; ss >> a >> ch >> b >> ch >> c; // a = 23, b = 4, c = 56 You have to complete the function vector parseInts(string str). str will be a string consisting of comma-separated integers, and you have to return a vector of int representing the integers. Note If you want to...
Draw parse trees for nine strings in question one, using their grammars. For the following grammars,...
Draw parse trees for nine strings in question one, using their grammars. For the following grammars, write the leftmost derivation for the strings given with each. Next to each derivation step, write the number of the rule used. Do not combine steps.   grammar (3 rules), Σ = {a, b}: S -> aSbS | bSaS | ε strings (3): ab, baab, bbaa grammar (6 rules), Σ = {0, 1}: S -> A1B A -> 0A | ε B -> 0B |...
Suppose the government imposes a binding price floor in the cheese market. Draw a supply-and-demand diagram to show the effect of this policy on the price of cheese and the quantity of cheese sold
Please answer the following question. Specific subject : MICROECONOMICSThe government has decided that the free-market price of cheese is too low.Suppose the government imposes a binding price floor in the cheese market. Draw a supply-and-demand diagram to show the effect of this policy on the price of cheese and the quantity of cheese sold. Is there a shortage or surplus of cheese?Farmers complain that the price floor has reduced their total revenue. Is this possible? Explain.In response to farmers’ complaints,...
Draw the labeled tree with Prufer code 344567
Draw the labeled tree with Prufer code 344567
draw statistics decision tree with 15 tests
draw statistics decision tree with 15 tests
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT