OP3402
Systems Programming
Spring 2011
|
email:
charles.e.hughes@knights.ucf.edu
Lectures: TR 1200-1315 (12:00PM to 1:15PM), HEC-118;
28 class periods, each 75 minutes long.
Labs: Section 11: Thursday
8:30-9:20; Section 12: Thursday 9:30-10:20
Go To Week 1, 2, 3, 4,
5, 6, 7,
8, 9, 10,
11, 12, 13,
14
Instructor: Charles Hughes; Harris Engineering Center 247C;
823-2762 (use e-mail; I spend most of my time in my lab)
Office Hours: TR 9:45AM-11:15AM
GTA: Remo Pillat, rpillat@knights.ucf.edu,
HEC308; OH: M 1430-1630 (2:30PM to 4:30PM)
Chris
Rees, serneum@gmail.com,
HEC308; OH: W 1500-1630 (3:00PM to 4:30PM)
Text: System
Software Knights (SSK),
University of Central Florida Custom Edition, Pearson Custom Publishing
2008,
ISBN 978-0-555-04647-0+Notes
Secondary References:
Compilers:
Principles, Techniques, & Tools, Second Edition by Alfred V.
Aho,
Monica S. Lam, Ravi Sethi,
and Jeffrey D. Ullman
System Software: An Introduction to
Systems Programming, Third Edition by Leland Beck
Concepts of Programming Languages,
Eighth
Edition by Robert W. Sebesta
Operating Systems: Internals and
Design Principles, Sixth Edition by William Stallings
Prerequisites: COP3502 (Computer Science I)
Web Pages:
Base URL: http://www.cs.ucf.edu/courses/cop3402/spring2011
Notes URL: http://www.cs.ucf.edu/courses/cop3402/spring2011/Notes/COP3402NotesSpring2011.pdf
Assignments: 6 to 10. Each assignment will have a due date
and 10% will be subtracted for each day late (up to 2 days late, 20%
off; more than two days late
results in no credit)
Exams: One or two midterms and a final
Material: I will draw heavily from text and especially from
Aho, Lam, Sethi and Ullman. You are responsible
for
material discussed in notes and in in-class discussions. Not all of
this is addressed in either of these texts. I highly recommend
attending class, interacting with me and listening very carefully when
I say a topic is important to me; hint, hint about exam questions ;-)
Exam Dates (Tentative): Exam#1 -- February 22;
Withdraw Deadline -- March 4; Exam#2 -- MAYBE; Final -- Thursday,
April 28,
10:00AM-12:50PM; Spring Break -- March 7-12
Evaluation (Tentative):
Mid Term(s) -- 20%
Final Exam -- 30%
Programming and Other Assignments -- 20%
Final Programming Project -- 25%
Wild Card -- 5% (for instance, to add weights to exams if I do a second
midterm)
Grading
will be A >= 90%, B+ >= 87%, B >=
80%, C+ >= 77%, C >= 70%, D >= 60%, F < 60%.
Week#1: (1/11, 1/13) -- Notes
pp. 1-48 (Chapter 1, Pages 1-42 of SSK); Syllabus
- Goals, expectations and rules of the course
- A bit of an insight into what I
do and what my background is in this domain
- Introduction to systems software
- Machine organization overview:
Von Neumann architecture
Week#2: (1/18, 1/20)
-- Notes
pp.
49-108 (Chapter 2 & 3, Pages 43-110, Chapter 4,
148-156 of SSK)
- Virtual machines overview: p-code (stack architecture)
- Language Processors: Compilers,
interpreters and analyzer
- Phases of a compiler
- Lexical analysis
- Syntactic analysis
- Context Analysis/Type Checking
- Semantic Analysis/Intermediate
code generation
- Code optimization (improvement)
- Code generation
- Handcrafted lexical analyzer
Assignment #1
Assign1Handout
Due: Part 1: February 1 by 11:59PM; Part
2: February 15 by 11:59PM(Key: C, H ) Test Cases
(1A); Grading
Criteria (1A)
Week#3: (1/25, 1/27) --
Notes pp.
67-72(again),109-137 (Chapter 5,
Pages 181-244)
- Another look at the phases, especially syntax analysis
- Regular
Expressions
- Building a lexical analyzer through
regular expressions
- FLEX lexical analyzer generator
(look for download specific to your platform)
- History of finite state automata
(FSA) -- circuits and pattern matching
- Regular expressions and FSAs
- FSAs and Regular Grammars
- Deterministic vs non
deterministic FSAs
Assignment #2
Starting with pascal.lex, change the rules in my
regular expressions to accommodate exponents in numbers.
Note: An integer followed by an exponent is a real.
Change it to include //, %, ++ and -- as you did in Assign#1. I already
did the comments, except for directives.
You do not need to manage directives in this assignment.
While you must just submit the modified grammar, I strongly recommend
you download FLEX and try it.
That's what we will do for checking your changes.
Due: February 17 by 11:59PM (Key) Comments
Week#4: (2/1, 2/3)
-- Notes
pp. 138-175 (Chapter
4, 111-141 of SSK)
- Syntax-directed translation
- Context free grammars
- Parse trees
- Notion of push down automata
(stack memory)
- Ambiguity and its relation to
non-determinism
- Non-ambiguity in expressions:
associativity and precedence
- Grammars for various programming
constructs: Expressions
- Syntax directed translation:
attributes and program fragments (semantic actions)
- Synthesized versus inherited
atributes
- Simple syntax-directed
translation amenable to automated parser generation
- Left vs right recursion and
top-down (predictive) vs bottom-up parsing
Week#5: (2/8, 2/10)
-- Notes pp.
176-211 (Chapter 4, 142-147, 263-300
of SSK)
- Expression grammars (precedence
and associativity)
- Extended BNF
- Converting left to right
recursion, maintaining semantic actions
- Left factoring
- Syntax graphs / Railroad charts
- Designing a recursive descent parser from a
right recursive grammar
Week#6: Notes pp.
212-228 (2/15, 2/17 (Review in Class; Help Sessions in Lab))
- Predictive parsing (First and
Follow sets)
- Nullable symbols and effect on
First and Follow
- Parsing table from First and
Follow
- Top down vs bottom up parsing
- CKY parsing (great example of
dynamic programming)
- Basic conflicts on top down and
on bottom up parsing
- Topics and Promises for
MidTerm # 1
- Sample Exam
-- Complete this for
discussion on 2/17 (key)
- Review and go over sample questions
Week#7: (2/22 (Midterm), 2/24) -- Notes pp. 229-257 (pp. 157-177 of SSK)
- Midterm
- Symbol tables
- Lexical, syntactic and
intermediate code based on flex and bison
- Notions of error recovery in
both various types of parsers
- While language processor: while.l and while.y
Assignment #3
Consider the grammar
S → AB | BA
A → CD | a
B → CE | b
C → a | b
D → AC
E → BC
Use CKY to determine if the following strings are in the associated language.
Report any ambiguity you encounter.
a.
abbab
b.
baba
c.
bbaabb
d.
abba
Answer Form is available to fill in.
Due: March 3 by 11:59PM (Key)
Week#8: (3/1, 3/3) -- Notes pp. 229-257 (pp. 157-177 ; 300-305 of SSK)
- Bottom up parsing of While language using Bison
- Symbol table management for While language
- Symbol table management and hash coding
- Symbol tables for nested declarations
- Intermediate code representation as triples
- Error recovery
- Clues on recursive descent parsing of While langauge
- Error recovery in recursive descent
- Initial discussion of data flow analysis
- Midterm Exam#1 Key
- Note: 3/4 is the
Withdraw Deadline
Assignment #4
Rewrite the While language compiler to intermediate code using recursive descent
You must provide the same features that I did on Bison/Flex version.
While language write-up; Reference solution: while.l and while.y
I have also placed Niklaus Wirth's full Pascal-S compiler and interpreter on the site.
Wirth's generated code is not useful but his parser and error recovery should help you.
Due: March 22 by 11:59PM
Week#9: (3/15, 3/17) -- Notes pp. 258-289 (pp. 305-331 of SSK)
- Bottom up vs top down and leftmost versus rightmost (once again)
- Finite state automata and pushdown automata
- Non-deterministic parsing via PDAs
- LR Parsing
- SLR as first example
- Basic algorithm
- LR(0) items and sets of items
- Closure of sets of items
- Action and Goto functions
- Building the parser
Week#10: (3/22, 3/24) -- Notes pp. 290-328 (pp. 331-359 of SSK)
- LR(1) items and sets of items
- Closure of sets of items
- Action and Goto functions
- Building the canonical LR parser
- Merging states and the LALR parser
- Reduce/reduce errors that might arise
- Ambiguity
- Error recovery
- Back to Recursive Descent (show code skeleton for Expression)
- Parse Trees versus Syntax Trees
- Code generation
- Triples versus Quads (compact versus easy to move)
Week#11: (3/29,
3/31) -- Notes pp. 329-344 (pp. 359-374 of SSK)
- Syntax directed translation
- Attributes (synthesized vs inherited)
- S-attributed and L-attributed parse trees
- Side effects during translation
- Creating syntax trees via attributes
- Code generation
- Triples versus Quads (compact versus easy to move)
- Indirect triples as a compromise
- Project discussion
Project
Due: April 26 by 11:59PM
Week#12: (4/5, 4/7)
-- Material comes from project description and Reference Solution
- Project Discussions -- lots of them
- Peephole optimizations
- Handling of function returns (not required in your project)
- Handling of Case (not required) -- Jump tables versus hashed jump tables vs if--then
- Equivalence classes (motivated by alias) -- union/find started
Week#13: (4/12,
4/14) -- Notes pp. 345-385
- Reference Solution in folder Assignments/Project/ReferenceSolution/
- Data flow anlysis
Week#14: (4/19, 4/21 (Review
in Class; Help Sessions in Lab)) -- Notes pp. 345-388
- Some data flow
- Interpreter for Rascal in folder Assignments/Projects/Triples Interpreter
- Union/Find -- almost constant
- Final Exam Topics
- Sample Final
(Key)
Final Exam; Thursday April
28; 10:00 - 12:50 in HEC118
© UCF (Charles E. Hughes)
-- Last Modified April 23, 2011