Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed 

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate accounting

Authors: J. David Spiceland, James Sepe, Mark Nelson

7th edition

978-0077614041, 9780077446475, 77614046, 007744647X, 77647092, 978-0077647094

More Books

Students also viewed these Programming questions