Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CS 2210: compiler construction

Homework #1 (60 points in total)

Due Time: september 30th, 2023

1.  (10 points) Briely describe why Java is considered to be a language that adopts interpreta- tion/ compilation hybrid implementation.

2.  (10 points) construct a deterministic inite state transition graph for regular expression

((0|1)* 0)|(001)

Here we have Σ = {0, 1}.

3.  (10 points) construct one regular expression for each of the following languages.

a)  All strings of lowercase letters that contain the ive vowels in order.

b)  strings with even number of quotes.  That is, ,abc,, abc”dd,aa,a,a,a, are legal strings while ,a, ,a,a,ab,a, are illegal strings.

4.  (15 points) construct one grammar for each of the following languages.

a)  The set of strings of 0s and 1s with an equal number of 0s and 1s. Σ={0,1}.     b)  The set of strings of 0s and 1s with an unequal number of 0s and 1s. Σ={0,1}. c)  The set of strings of the pattern aibj  c(i+j) (i,j,k>1). Σ={a,b,c}.

5.  (15 points) After reading the source code of project 1, please answer the following questions.

a)  How does the code achieve case insensitivity for identiiers and keywords?

b)  Given two identiiers appearing at different places in the input, how does the code ensure that it returns the same index?

c)  How does the code prevent a keyword, e.g., “if”, from being recognized as a normal identiier?