0% found this document useful (0 votes)
60 views2 pages

Tasks For Final Exam

Students must complete a final project independently involving implementing three compiler components: regular expressions to DFA conversion, LL(1) parsing, and LR(0) parsing. They must write programs to automate each conversion process and write a report documenting their designs, algorithms, test cases, and instructions for running programs and tests. Source code, test cases, and a report are required deliverables. Plagiarism will result in a failing grade.

Uploaded by

Nigel Croner Zin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views2 pages

Tasks For Final Exam

Students must complete a final project independently involving implementing three compiler components: regular expressions to DFA conversion, LL(1) parsing, and LR(0) parsing. They must write programs to automate each conversion process and write a report documenting their designs, algorithms, test cases, and instructions for running programs and tests. Source code, test cases, and a report are required deliverables. Plagiarism will result in a failing grade.

Uploaded by

Nigel Croner Zin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Final Exam for Compiler F200301、F200302

Attention:
All the students need to finish the project independently and
give the final report( A report just give the designing scheme with
words, tables, figures and so on, not just paste the source code ).
If plagiarism is checked, all the similar reports are given as fail
(<60).s
s
Objective:
The objective of this assignment is to implement three important
components of a compiler: regular expression to DFA conversion, LL(1)
parser construction, and LR(0) parser construction. These tasks will
help in understanding the fundamental concepts and techniques used in
compiler design.

Tasks:
1. Regular Expression to DFA Conversion:
Implement an algorithm to convert a given regular expression into
an equivalent Non-Deterministic Finite Automaton (NFA).
Convert the NFA into a Deterministic Finite Automaton (DFA).
Minimize the DFA by eliminating redundant states, if necessary.
Write a program to automate the conversion process.
The example regular expression:
(a|b)*ca*

2. LL(1) Parser Construction:


Design a context-free grammar that represents a programming
language syntax.
Construct the LL(1) parsing table, which includes sets of non-
terminals, terminals, and productions.
Implement a recursive descent parsing algorithm that utilizes the
LL(1) parsing table.
Write a program to parse a given input program using the LL(1)
parser.

The example CFG:


Non-terminals: {S, E, T, F}
Terminals: {id, +, *, (, )}
Productions:
1. S -> E
2. E -> TE'
3. E' -> +TE'
4. E' -> ε
5. T -> FT'
6. T' -> *FT'
7. T' -> ε
8. F -> (E)
9. F -> id

3. LR(0) Parser Construction:


Design a context-free grammar for a programming language.
Construct the LR(0) parsing table, which includes sets of non-
terminals, terminals, productions, and state transitions.
Implement the LR(0) parsing algorithm using the parsing table.
Write a program to parse a given input program using the LR(0)
parser.
The example CFG:
Non-terminals: {S, A}
Terminals: {a, b}
Productions:
S -> Aa
S -> b
A -> aA
A -> ε

Deliverables:
1. Source code for the regular expression to DFA conversion program.
2. Source code for the LL(1) parser program.
3. Source code for the LR(0) parser program.
4. A report documenting the design choices, algorithms, and test
cases used for each component.
5. Test cases to verify the correctness and functionality of each
program.
6. Instructions for running the programs and conducting the tests.
7. Make sure to include relevant comments and explanations in the
source code to enhance readability.

Additional Guidelines:
1. Make use of suitable programming languages for implementing the
assignments, such as Python, C++, Java, or any other language of
your choice.
2. Test the programs with different inputs to ensure their
correctness and handle possible edge cases.
3. Document any assumptions made during the implementation and
testing process.

You might also like