cs5363-final - CS5363 Final Exam Dec 14, 2010 1. (7pts)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS5363 Final Exam Dec 14, 2010 1. (7pts) Construct a regular expression for each of the following sets of strings. (a) Identifiers accepted by the C language (e.g., My id, var7). (b) All strings over alphabet { a, b, c } that do not contain substring aa. For example, abcac is in the language, but aab is not. 2. (8pts) Write context-free grammar for each of the following languages. (a) The language expressed by regular expression ( abc ) * ( a | b ) c . (b) The set of expressions over { var, , ± , ( , ) } where var stands for all variable names, and both and ± are binary operators. Parentheses are used to regroup operations and must be properly nested. Your grammar should enforce that both and ± have the same precedence, is left associative, and succ is right associative. 3. (18pts) Suppose we have the following context-free grammar, where type can be either int or float , and var stands for arbitrary variable names. Goal ::= type S S ::= S ; var | var (a) Using either the top-down or bottom-up approach, build a predictive LL(1) parse table or a LR(1) parse table for the given grammar. Provide necessary intermediate steps. Building either an LL(1) or an LR(1) table is sufficient (no need to do both). (b) Add translation schemes to the given grammar to count the number of variables inside an
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/29/2012 for the course CS 5363 taught by Professor Staff during the Spring '08 term at The University of Texas at San Antonio- San Antonio.

Page1 / 2

cs5363-final - CS5363 Final Exam Dec 14, 2010 1. (7pts)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online