Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Practice Test on Grammar and Parsing - Prof. Santosh Pande, Exams of Computer Science

Practice test questions on various topics related to grammar and parsing, including constructing parse trees, deriving sentences, removing left recursion, and computing first() and follow() sets.

Typology: Exams

Pre 2010

Uploaded on 08/05/2009

koofers-user-ex8
koofers-user-ex8 🇺🇸

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download Practice Test on Grammar and Parsing - Prof. Santosh Pande and more Exams Computer Science in PDF only on Docsity! Practice Test 2 Question 1: Give a context-free grammar over S={0,1} that generates the following language: {w | w =wR , that is, w is a palindrome} Question 2: Consider the grammar S.(L) | a L. L,S|S 1. Find parse trees for the following sentences: 1. (a,a) 2. (a,(a,a)) 3. (a,((a, a),a),a))) 2. Construct the corresponding rightmost derivations of the sentences in (1). 3. Construct the corresponding leftmost derivations of the sentences in (2). 4. Remove left recursion. Question 3: Consider the following grammar S.aAb | bBa| Ac| Bc A.aBb | e B.bAa | e 1. Compute the first and the follow set of the variables 2. Is this grammar LL(1)? Why or why not? Question 4: The algorithms mentioned in class (review relevant lecture slides) to computer First() and Follow() sets are somewhat inefficient. Using the respective dependencies of First() and Follow() sets as given by the grammar, write more efficient algorithms to compute First() and Follow() sets.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved