hw1 - Kleene closure) of the regular expression operations...

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

View Full Document Right Arrow Icon
COP4020 Spring 2012 Homework Assignment 1 (Due Feb. 8 before class). 1. (20 points) Errors in a computer program can be classified according to when they are detected and, if they are detected at compile time, what part of the compiler detects them. Assuming we use C/C++, give an example of each of the following. a) A lexical error, detected by the scanner (hint: the scanner accepts only ASCII characters that are legal to use in C) b) A syntax error, detected by the parser c) A static semantic error, detected by semantic analysis d) A dynamic semantic error, detected by the code generated by the compiler 2. (20 points) Convert the regular expression letter ( letter | digit )* to an NFA using the NFA equivalents (base case, concatenation, alternation,
Background image of page 1

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

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

Unformatted text preview: Kleene closure) of the regular expression operations as can be found on page 55 and 56 in the textbook. 3. (50 points) Consider the following LL(1) grammar for a simplified subset of Lisp P E E atom E ( E Es ) Es E Es a. Compute the first and follow set of all nonterminals. b. Construct the LL(1) parse table for the grammar c. Show step-by-step (content of stack and input string, as well as the parser action) how the following program is parsed: (cdr (a b c)) d. Show the parse tree of the program in c. 4. (10 points) Eliminate left recursion in the following grammar: S A a | b A A c | S d |...
View Full Document

Page1 / 2

hw1 - Kleene closure) of the regular expression operations...

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