Click here to load reader
Upload
duongdang
View
324
Download
8
Embed Size (px)
Citation preview
Design practicalCompiler Construction1
S C I E N C E n P A S S I O N n T E C H N O L O G Y
u www.tugraz.at
Univ.-Prof. Dr. Franz Wotawa, DI Roxane KoitzMartin Zimmermann, Christopher Liebmann, Stephan Frühwirt
Institute for Software Technology
Compiler Construction(1 Design practical) 716.077 SS 2017
Design practicalCompiler Construction2
Design practicalCompiler Construction3
But …. what is a compiler?Source: xkcd.com
Design practicalCompiler Construction4
What are the parts/phases of a compiler?position = true + 1
Lexer
character stream
Parser
tokens<id,1> <=> <bool,true> <+> <1>
syntax tree
<1>
=
<id,1> +
<bool,true> Type
Checker
syntax tree<1>
=
<id,1> +
boolToInt
true
Design practicalCompiler Construction5
IntermediateCodeGenerator
t1 = boolToInt(true)t2 = t1 + 1id1 = t2
syntax tree
Optimization
intermediate code rep.id1 = 2
movl $2, %ecx
intermediate code rep.
target language
What are the parts/phases of a compiler? (2)
CodeGenerator
<1>
=
<id,1> +
boolToInt
true
Design practicalCompiler Construction6
Overview Design Practical
Team work• 4 students/group (1 team leader)• Electronic registration system (Deadline: March, 15th
23:59:59)• If not possible to form group of 4: email to
[email protected] before deadline (name, matriculation number)
• Registration to a group à grade
Theoretical Exercise Sheets
Practical ProgrammingAssignments
• 30 % influence on grade• 3 theoretical sheets
• 70 % influence on grade• 3 practical assignments • Bonus tasks
Design practicalCompiler Construction7
Theoretical Exercise Sheets• 3 sheets/10 points each
• Website: Collection of assignments and tasks
• Cover sheet
• Submission: • Hard copy • Cover sheet• 12 pm (noon)• Mail box
• No submissions via e-mail• No late submissions• Please write legibly
716.077 Compiler Construction (1 KU)
Exercise Sheet 1
Group members G-No
1
2
3
4
Task Points Done Points
Example 1.2 (c) 2 2
Example 1.3 2 2
Example 1.4 (a) 2 2
Example 1.5 4 2
Sum
Design practicalCompiler Construction8
Theoretical Exercise Sheets (2)• Delivery: Mail box
Design practicalCompiler Construction9
Programming assignment
Jova Compiler
Design practicalCompiler Construction10
Jova
• Simple OO • Classes• Member variables• Methods• If/while stmts• …• Types
• Primitive: int, bool, String• Class Types (Ctype)• nix (=null)
• Specification on assignment sheet
Design practicalCompiler Construction11
Jova Input Program
Java Byte Code
Compiler Phasen
Assignment 1: Lexer + Parser (15 %)Assignment 2: Type Checker (30%)Assignment 3: Code Generation (25%)Bonus Tasks
Design practicalCompiler Construction12
Practical Assignments• 3 practical assignments
• Assignment 1: Lexer + Parser (15%)• Assignment 2: Type Checking (30%)• Assignment 3: Code Generation (25%)• Bonus tasks
• List of bonus tasks
• Website: Framework, assignment description and additional resources
• Framework• Skeletons of required classes, helpers, libs,
build.xml,…• Testing: Keep to the given structure, Main class,…
Design practicalCompiler Construction13
• Submission: SVN
• Late submission• Each assignment may be handed in 24 hours after the
deadline [ 22 (4) TU statutes]• Must write us an email before the 24 hour extension• 25% deduction of points on the assignment• No other deadline extension
• Sample code• If you could not solve an assignment ask via email for
sample solution• Must see an honest effort in trying to solve the task• 50% deduction of points on the next assignment
Practical Assignments (2)
Design practicalCompiler Construction14
Practical Assignments (3)• Automatic tests
• Test framework (coming up)• Specification!
• E.g. file structure, output format, correct error message,…
• Mandatory interviews after each task
• No Plagiarism (also for theoretical part)• Upload to external server for cross checking
Design practicalCompiler Construction15
Theoretical exercise sheets Delivery due date
Exercise Sheet 1 March, 27th 12 pm (noon)Exercise Sheet 2 April, 24th 12 pm (noon)Exercise Sheet 3 May, 29th 12 pm (noon)
PracticalAssignment 1
PracticalAssignment 2
PracticalAssignment 3
Tutorial March, 6th March, 27th April, 24th
Question Hour March, 13th April, 3rd May, 8th
Delivery due date
March, 27th
12 am (midnight)May, 2nd
12 am (midnight)May, 29th
12 am (midnight)Interview March, 30th or
March, 31stMay, 4th or
May, 5thJune, 1st or June, 2nd
Important datesGroup Registration (online): March, 15th 12 am (midnight)
Design practicalCompiler Construction16
Mo Tue Wed Th FrMarch 6.3. Tut.A1
13.3 ?-Hour A1 15.3 Deadline Group Reg.
20.3
27.3 DeadlineA1/ES1,Tut. A2
30.3Interview A1
31.3Interview A1
April 3.4. ?-Hour A210.4 Easter17.4 Easter24.4 Deadline ES2, Tut. A3
May 1.5 Nat. Holiday
2.5. DeadlineA2
4.5Interview A2
5.5Interview A2
8.5. ?-Hour A315.5
22.5
May/June
29.5 Deadline A3,ES3
1.6Interview A3
2.6Interview A3
A... Practical Assignment #, ES .... Exercise Sheet #
Design practicalCompiler Construction17
Questions
• Newsgroup : tu-graz.lv.cb
• Mails: [email protected]
• Tutorials / Question hour
• Office hours
• Lecture: Prof. Wotawa – Tuesday, 1pm -2pm
• Practical: Roxane Koitz – Monday, 1pm -2pm
• In the lecture
Design practicalCompiler Construction18
Notes and Tips• Reading of newsgroup, emails and website is mandatory!
• Go to the tutorials/question hours/lectures
• Start early
• especially Type Checker
• NG posts and emails may not be answered on weekends, nights, public and university holidays, etc.
• Specification, specification, specification…
• Read the assignment description carefully
• When in doubt à ask (early enough) in the newsgroup/question hour/tutorial/office hours/ email
Design practicalCompiler Construction19
Questions?