Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following six questions are adapted from exercise 2.18 of Chapter 2 of Programming Language Pragmatics, by Michael Scott. Consider this context free grammar
The following six questions are adapted from exercise 2.18 of Chapter 2 of Programming Language Pragmatics, by Michael Scott. Consider this context free grammar for a simplified subset of Lisp: S T atom ' S (ST) S T 1. Using this grammar, give the parse tree for the program string (cdr (a b)) $ (note that "cdr", "a", and "b" are each tokenized as "atom"). 2. Find the first set for each of the production rules of this grammar. 3. Find the follow set for each of the production rules of this grammar. 4. Build the parsing table from these first and follow sets. 5. Using the pseudocode from Figure 2.18 of your recommended reading (which will be distributed and discussed in class), show a trace of the stack and the input over time for the string given in question 1.
Step by Step Solution
★★★★★
3.43 Rating (150 Votes )
There are 3 Steps involved in it
Step: 1
Lets break down each question Parse Tree The parse tree for the program string cdr a b would l...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started