Cs606 merged file fnl trm.pdf

Verified academic study resource for CS606 (Compiler Design & Construction) under the Computer Science at Virtual University of Pakistan. This PDF document (Verified Study Resource) covers Full Course Curriculum spanning approximately 280 pages across 8 curriculum modules, and is indexed for student examination review with instant in-browser preview and 100% free direct download.

Course
CS606 – Compiler Design & Construction
Faculty
Computer Science
Format
PDF
Type
Study Resource
Coverage
Full Course Curriculum

Review this document alongside the official handouts and test your retention in the Interactive MCQs Studio.

What this file covers — CS606 syllabus roadmap

  1. Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
  2. Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
  3. Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
  4. Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)
  5. Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
  6. Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
  7. Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
  8. Final-Term Examination Dossier & Capstone Synthesis — Lectures 42 to 45 (Pages 511 to 585). Final-Term Exam Synthesis (Lectures 23–45 Scope)

Frequently asked questions

Where can I download Cs606 merged file fnl trm.pdf for free?

You can preview and download "Cs606 merged file fnl trm.pdf" (CS606 PDF, ~280 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs606-merged-file-fnl-trm-pdf) with 100% free high-speed downloads and zero registration requirements.

What syllabus chapters and lectures are covered in this CS606 file?

This document covers Full Course Curriculum across 8 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22, Lectures 23 to 29, Lectures 30 to 36, Lectures 37 to 41, Lectures 42 to 45), featuring comprehensive definitions, solved objective questions, and examiner marking rubrics.

What is the passing criteria for CS606 under the VU 20% Two-Half Rule?

Under official Virtual University regulations, students must score at least 20% in the First Half (Quizzes, Assignments, GDBs, and Midterm combined) AND independently at least 20% in the Final-Term examination paper. Scoring under 20% in the final exam results in an automatic F grade regardless of earlier marks.

Are CS606 solved past papers and handouts verified for 2026 exams?

Yes. All CS606 materials on MIHORA VU—including Moaaz, Waqar Siddhu, and team archives—are reviewed against the current VU syllabus to help students prepare for 2026 Midterm, Final-Term, and online quiz examinations.

Inside this file

ORANGE MONKEY

Lecture 18
Computing FIRST Sets

Here is the algorithm for computing the FIRST sets.

This strategy is encoded in the following procedure

Example : consider the expression grammar
again

       1 E     ? T E'
       2 E'    ? + T E'
       3       | ε
       4 T     ? F T'
       5 T'    ? * F T'
       6       | ε
       7 F     ? (E)
       8       | Id

Sohail Aslam              Compiler Construction CS606   65

FOLLOW Sets

Definition:

Computing FOLLOW Sets:

Sohail Aslam        Compiler Construction CS606   66

The following procedure encodes this strategy.

Let’s apply the algorithm to the expression grammar.

Put $ in FOLLOW(E ). By rule (2) applied to production ? ( E ), ‘)’ is also in
FOLLOW(E ). Thus, FOLLOW(E ) = { ), $}. By rule (3) applied to
production
E ? T E' , $ and ‘)’ are in FOLLOW(E' ). Thus, FOLLOW(E ) = FOLLOW
(E' ) = { ), $ }. Similarly, FOLLOW(T ) = FOLLOW (T' ) = { +, ), $ } and
FOLLOW(F ) = { +, , ), $ }

Sohail Aslam                Compiler Construction CS606                      67

Lecture 19

LL(1) Table Construction

Here now is the algorithm to construct a predictive parsing table.

Left Factoring

Consider the grammar

       E? T+E | T
       T ? int | int T     | (E)

It is impossible to predict because for T, two productions start with int. For E, it
Sohail Aslam               Compiler Construction CS606                             68

is not clear how to predict; the two productions start with the non-terminal T.
A grammar must be left factored before use for predictive parsing. The
procedure to left-factor a grammar is as follows:

A graphical explanation:

Example: consider following fragment of expression grammar

       Factor ?       id
                  |   id [ ExprList ]
                  |   id ( ExprList )

After left factoring, the grammar becomes

       Factor ? id Args
       Args    ? [ ExprList ]
               | ( ExprList )
               | ε

Given a CFG that does not meet the LL(1) condition, it is un-decidable whether
or not an equivalent LL(1) grammar exists.

Sohail Aslam                Compiler Construction CS606                           69

Lecture 20

Bottom-up Parsing

Bottom-up parsing is more general than top-down parsing. Bottom-up parsers
handle a large class of grammars. It is the preferred method in practice. It is also
called LR parsing; L means that tokens are read left to right and R means that the
parser constructs a rightmost derivation. LR parsers do not need left-factored
grammars. LR parsers can handle left-recursive grammars.

LR parsing reduces a string to the start symbol by inverting productions. A
derivation consists of a series of rewrite steps

Each γi is a sentential form. If γ contains only terminals, γ is a sentence in L(G). If
γ contains ≥ 1 nonterminals, γ is a sentential form. A bottom-up parser builds a
derivation by working from input sentence back towards the start symbol S.

Consider the grammar

S      → aABe
A      → Abc | b
B      → d

The sentence abbcde can be reduced to S:

               abbcde
               aAbcd
               e aAde
               aABe S

These reductions, in fact, trace out the following right-most derivation in reverse:

S       aABe
       aAde
       aAbcde
       abbcde

S aBy aγy xy

Sohail Aslam                Compiler Construction CS606                                   70

                         S
                                         rule: B → γ

                         B
                    α

                            γ

                        x                y

                                   Terminals only

Consider the grammar

               1.       E → E + (E)
               2.            | int

The bottom-up parse of the string int + (int) + (int) would be

       int + (int) + (int)
       E + (int) + (int) E
       + (E) + (int)
       E + (int)
       E + (E)
       E

The consequence of an LR parser tracing a rightmost derivation in reverse is that
given αβγ be a step of a bottom-up parse, assuming that next reduction is A → β
τhen γ is a string of terminals. The reason is that αAγ → αβγ is a step in a
rightmost derivation. This observation provides a strategy for building bottom
up parsers: split the input string into two substrings. Right substring (a string of
terminals) is as yet unexamined by parser and left substring has terminals and
non-terminals. The dividing point is marked by a ►(the ►is not part of the
string). Initially, all input is unexamined: ►x 1 x 1 . . . x n.

Shift-Reduce Parsing

Bottom-up parsing uses only two kinds of actions:

       1. Shift
       2. Reduce

Sohail Aslam                    Compiler Construction CS606                      71

Shift moves ►one place to the right which shifts a terminal to the left stringE

       + (►int)        E + (int ►
                                )

In the reduce action, the parser applies an inverse production at the right end
of the left string. If E → E + (E) is a production, then

       E + ( E+(E)►
                  )       E+(E►
                              )

Shift-Reduce Example

       ► int + (int) + (int) $ shift
       int ►+ (int) + (int) $ reduce E → intE
       ►+ (int) + (int) $       shift 3 times
       E + (int ►) + (int) $    reduce E → int
       E + (E ►) + (int) $      shift
       E + (E) ►+ (int) $       reduce E → E+(E)
       E ►+ (int) $             shift 3 times
       E + (int ►)$             reduce E → int
       E + (E ►)$               shift
       E + (E) ►$               red E → E+(E)
       E ►$                     accept

Sohail Aslam               Compiler Construction CS606                            72

Lecture 21

Shift-Reduce: The Stack

A stack can be used to hold the content of the left string. The Top of the stack is
marked by the ►symbol. The shift action pushes a terminal on the stack.
Reduce pops zero or more symbols from the stack (production rhs) and pushes
a non-terminal on the stack (production lhs)

More CS606 files

All CS606 files · Midterm Prep 2026 · MCQs Bank