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],...
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...
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
Write the code to manage a Binary Tree. Each node in the binary tree includes an integer value and string.
Programming CWrite the code to manage a Binary Tree. Each node in the binary tree includes an integer value and string. The binary tree is sorted by the integer value. The functions include:• Insert into the binary tree. This function will take in as parameters: the root of the tree, the integer value, and the string. Note that this function requires you to create the node.• Find a node by integer value: This function takes in two parameters: the root...
Use a 2 step binomial tree to value a new exotic derivative. Draw the tree and...
Use a 2 step binomial tree to value a new exotic derivative. Draw the tree and label the stock prices and derivative values at each node. The option expires in 6 months. The interest rate is 10% annually continuously compounded. The Strike Price (K) is 100. The spot price is at 100. U= 1.2 and D= 0.8 for each quarterly period. The payoff of this derivative is (ST/K). By this I mean that the payoff is the price of the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT