CST 320 Compiler Methods
Winter 2009
Instructor:   Dr. Sherry Yang


 What's New

Make-Up Test Wednesday in CFLAT
Things you should know for the make-up test:
- Phases of compilation
- Symbol table
-Compute the first and follow sets of a grammar.
- Given first and follow sets, construct a LL(1) table. 
- Given a LL(1) table, trace an input using the table. 
- Given a grammar, outline the recursive descent parser for the grammar.  If the grammar is not in the right form for recursive descent parser, fix it. 
- Given a problem, write a lex and a yacc file to parse the input. 
- Grammar modifications
   - Remove lambda, remove unit, remove left recursion
 

For the final project, if you pick the option of writing a cheat detector for CST116 labs.  You'll need to:
1)  Get 5 actual labs from Todd or Randy
2)  Read and Parse those .cpp files (You might need to add some rules to your grammar to include C++ statements)

3)  Compute metrics on those programs.  You must compute the following metrics:
  Total  Number lines of code
-  Total  Number of program tokens
-   Total Number of statements
-  Number of each type of statemenst (if,while, assignment, etc.)
-  Number of operators 
-  Number of function calls
-  Number of functions
-  Highest nesting level
-  Total number of identifiers
-  Average identifier length
-  Longest identifier length
-  Longest function length
-  Percentage of comment lines - percent of source lines containing comments
-  Number of parameters per function
-  Number of types used
- Average function length
-  Number of directly recursive calls

-  Recursive Descent Example

LL1 Follow Set construction example (in class 2/11/09)
 


Tentative Course Schedule
 
Lectures, Handouts and Assignments
Week 1 
 
Syllabus

Reading:  Chapters 1, 2, & 8

Week 2
 
Notes:  Introduction to Translators
Notes:  Lexical Analyzer

Lab #1Due Monday, Jan. 19 (Lexical Analyzer and Preprocessor)
Lab#1 Check-Off List

HW#1Due Monday, Jan. 12


Reading:  Chapter 3

Notes:  Grammar Transformations
Notes:  Top-Down Parsers

HW#2:  Due Friday, Jan. 16

HW#3: Due Monday, Jan. 26

C Minus Grammar Example

Week 3
 
NO Class on Monday (Holiday)
Week 4
 
Lecture:  LL(1) parsers

Some Slides on STL Map
A sample LL(1) header file

 Lab# 2 (Due Wednesday, Feb. 4)
Lab#2 Check-Off List

No Class on Wednesday or Friday

No Lab this week

Week 5
 
Test #1 on Friday, Feb. 6

Reading:  Chapter 4

Lecture:  Lex and Yacc
Lecture:  Lex and Yacc2

Week 6
 
NEW Download Pargen Software for Lab4

NEW Lex/Yacc Files for C++

NEW README for Pargen/Lab4 stuff

Misc. Lex/Yacc Files (mostly written in C)

HW#4: Due Friday, Feb. 13th

Lab# 3 (Due Wednesday, Feb. 18th)
Lab#3 Check-Off List

Week 7
 

 

Week 8 
 
Lecture: Semantic Analysis

Lab #4(Due Monday, Mar. 2nd )
Please include input and output files with your lab submission. 

Week 9
 

Test#2 Friday, March 6th

Week 10
 
NO Class on Wednesday and Friday.  Work on your project

Project: DUE on Monday, Mar. 16th. (No Late Projects accepted).  Project check-off on Monday, 1-4pm

Project Check-Off List

Make-up Test on Wednesday, March 11th (in CFLAT)

Finals Week
 
 

Created by: Dr. Sherry Yang, sherry.yang@oit.edu.