Professional Documents
Culture Documents
Ecx5265 - Software Construction - Tma 01 Important
Ecx5265 - Software Construction - Tma 01 Important
Important:
Submission deadline August 12, 2010
No late submissions will be accepted.
2.
3.
(a) Draw NFA for the regular expression (1*01*0)*1* over the alphabet Σ = {0, 1}
(b) Check the sentence w = “1010” belongs to the language generated by above 3(a).
(c) Starting from the NFA you constructed in 3(a), derive the DFA.
(d) Verify that the DFA yields the same output as the original NFA for the same input
string w.
1
THE OPEN UNIVERSITY OF SRI LANKA
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
ACADEMIC YEAR – 2010/ 11
BACHELOR OF SOFTWARE ENGINEERING
ECX5265 – SOFTWARE CONSTRUCTION - TMA 02
Important:
Submission deadline October 12, 2010
No late submissions will be accepted.
2. (a) Briefly describe the PDA model and name two ways by which a language can be
accepted.
(b) Describe the types of moves made by PDA.
(c) Find the PDA that accepts the language generated by a grammar with the
productions; (Start symbol is S)
S bA
A aAb | ab
B a
(d) Show that the PDA found in 2(c) is equivalent to the given grammar.
Part B
2
THE OPEN UNIVERSITY OF SRI LANKA
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
ACADEMIC YEAR – 2010/ 11
BACHELOR OF SOFTWARE ENGINEERING
ECX5265 – SOFTWARE CONSTRUCTION - TMA 03
Important:
Submission deadline December 29, 2010
No late submissions will be accepted.
Part B
3
THE OPEN UNIVERSITY OF SRI LANKA
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING
ACADEMIC YEAR – 2010/ 11
BACHELOR OF SOFTWARE ENGINEERING
ECX5265 – SOFTWARE CONSTRUCTION - MINI PROJECT
Consider the following Context Free Grammars for a compiler, called C --.
C -- Grammar
4
Expr Primary
UnaryOp Expr
Expr BinOp Expr
id = Expr
id [ Expr ] = Expr
Primary id
num
( Expr )
id ( ExprList )
id [ Expr ]
ExprList epsilon
ExprListTail
ExprListTail Expr
Expr , ExprListTail
UnaryOp -|!
BinOp + | - | * | / | == | != | < | <= | > | >= | && | ||
The given CFG is connected to Part B of TMA 02, 03 as well as your Mini project.
Mini project consists of altogether three parts (#1, #2 & Final).
5
MP - Part #2 [60 marks]
1. Implement a recursive decent parser that recognizes the LL(1) grammar. Use your
Part #1 solution as a starting point.
2. Test it and includes results in a descriptive form for the above steps.
3. Write down your code generator(s) in pseudo code.
4. Implement the code generator and complete C -- compiler.
Your compiler should take the name of a C -- program input file and produce a
stack machine code output file. It should be able to handle most (or all) of the
C -- program specifications described in Part #1, including function calls,
parameter transmission of both arrays and non-arrays, and global and local
variables etc.
5. Test it and includes results in a descriptive form for the above steps.
- END.