91.406/91.535 Compiler Construction I

Instructor: Jim Canning

Articles

(1) Article 7, The New Turing Omnibus: The Chomskey Hierarchy
(2) Lex - A Lexical Analyzer Generator, M.E. Lesk and E. Schmidt
(3) A Compact Guide to Lex and Yacc, Thomas Niemann
(4) Yacc: Yet Another Compiler-Compiler, Stephen C. Johnson

It would be good if you can get a copy of the 1990 version of An Introduction to Compiling Techniques, a First Course using ANSI C, LeX, and YaCC by JP Bennett.
It is published by McGraw Hill International Series in Software Engineering.

What are we going to do.
The course seeks students who are willing to put in the required, steady effort spread evenly across the semester.

I have given each student a code name. If you wish to know your code name, let me know.

Assignment
Due Date
Name

Parser
Wednesday, February 9th, 2011
parser1

Parser + Symbol Table
To be announced shortly.
symbol1














Things to Do:
Step
Description


Step 0
This is just a lexer assignment. It does not need to be handed in. However, for those who are not use to lex, this activity is useful to do so that you can get your wits about you. I pass this assignment out in class. I have placed an initial y.tab.h in my public directory. I have given an initial pascal.l to you too. This pascal.l has a main function located in its 3rd area. This program will not recognize reserved words appropriately. Reserved words will report themselves as IDs. However, getting little program to work is an initial step along our path.


Step
1
This is the parser assignment. In this assignment you need to be able to succesfully parse the six testcases in my public directory. In this assignment, you should cull out the main function and place it into a a file of its own. You need to write pascal.y and an updated pascal.l. After you get the parser to work, you should submit it to me. Use the name parser1.


Step
2
This is the symbol table assignment. In this assignment you need to be able to parse test case files that reflect the grammar contained in Appendix A. You can change the grammar a bit if you wish. Your submission will be evaluated on test cases that the Appendix A grammar can handle. If you look at the grammar you will see that functions and procedures can be nested within the main program. But  additional nesting is not allowed. We will, hopefully, extend this in a future assignment so if you wish to figure out how to handle deeper static nesting, then you can plan for that now or you can wait and pick that functionality up a bit later. For this step, test case will have at most one level of nesting as reflected in the given






We have 25 students.

Current Parser Scores:

10  students received 10
2    students received  9
7    students received  7
2    student received   6
4    students currently have a score of 0 (Why is this??)


Code Name
Parser
Submitted
 On Time
On-Time
Parser
Working
Late
Late
Working
Parser
Points
Symbol 1
Points
Comment



1
Wang Lung
No
No


0





2
Johnny Tremain
Yes
No
Yes
Yes
7





3
Jean Valjean
Yes
Yes


10





4
Holden Caulfield
Yes
Yes


10





5
Anne Shirley
No
No
Yes
Yes
7





6
Guy Montag
Yes
Yes


10





7
Santiago
Yes
No


0

main just calls lexer. parser has issues



8
Quasimodo
Yes
No
Yes
Yes
7





9
Cedric the Saxon
Yes
No
Yes
Yes
7





10
John Galt
Yes
Yes


10





11
Tom Joad
Yes
Yes


9

Lex warnings



12
Edmond Dantes
Yes
No


0

Broken parser1.y. Missing pieces. Seems confused to me.



13
Pip
Yes
Yes


10





14
Snowball
Yes
No
Yes
Yes
6

(No Makefile, no main.c code, no .l, no .y,) (extra misc parenthesis on output)



15
Stephen Dedalus
Yes
Yes


10





16
Dagny Taggart
Yes
Yes


10





17
Sancho Panza
Yes
No
Yes
Yes
7

Warning message about extra characters??



18
Buck
No
No
Yes
No
0

No pascal.y submitted - only a lexer.



19
Willie Loman
Yes
No
Yes
Yes
7





20
Howard Roark
Yes
Yes


9

Lex warnings



21
Atticus Finch
Yes
Yes


10





22
Silas Marner
Yes
Yes


10





23
La Longue Carabine
Yes
No
Yes
Yes
7





24
Gulliver
No
No
VV Late
Yes
6





25
Francisco d'Anconia
Yes
Yes


10