Compiler Design-Assignment-1
Compiler Design-Assignment-1
E → E + E| E * E | id
Construct the parse tree for the above grammar using LMD for the given string id + id + id + id * id
Q4. Explain tokens with their types. Identify the types of tokens in the following code segment.
Q5. Construct a DFA over the input alphabet Σ= {a, b} for the following:
(i) Each string starts with “a” and ends with “b”.
(ii) Set of all even length strings.
(iii) Set of all odd length strings.
(iv) String length is exactly 2.
(v) String length is at least 2.
(vi) String length is at most 2.
(vii) Each string ends with “bb”
(viii) Set of all length strings including zero length.
Note- The respective class CR will submit the assignment to me with the list of students who submit
the assignment. Kindly refer the below format for the same.
S. No Class Roll No Student Name Date of Submission
1 1 A 10-April-24
2 2 B
3 3 C