University Of Pretoria SA Coronavirus Website Computer Science Department

COS341 - Compiler Construction

Announcements

Module Content

Background Reading - Background Reading
Chen-Erwig.pdf
Paper by Chen and Erwig: "When type inference fails, it is often difficult to pinpoint the cause of the type error among many potential candidates. Generating informative messages to remove the type error is another difficult task due to the limited availability of type information. Over the last three decades many approaches have been developed to help debug type errors..."
GLR_McPeak.pdf
This paper explains the Generalised LR parsing technique (GLR) which can cope even with ambiguous context-free grammars.
GLR_Johnstone.pdf
This paper discusses the computational runtime costs of Generalised LR parsing (GLR)
Pepper.pdf
In this paper, professor Peter Pepper from the Technical University of Berlin (Germany) explains how you can safely transform a given grammar to make it better suitable for parsing.
Kruse.pdf
Though the detection of ambiguities in context-free grammars is generally UNdecidable, the situation is not entirely hopeless: In this BSc-Dissertation, a young BSc-Student from Germany is giving you a lot of help which you can apply when you need to search your ambiguities in your Practical Project grammar. If a young BSc-student from Germany can do it, then you can do it, too :)
Knuth.pdf
The LR(k) grammars/languages are the genuine sub-class of all those context-free grammars/languages that can be handled by a DETERMINISTIC Push-Down Automaton (PDA) with 1 stack. (Remember that deterministic PDA are "weaker" than non-deterministic PDA, whereas NFA and DFA, without any stack, are equally strong). In this classical paper, "grandmaster" Donald Knuth explains the parsing of LR(k).
Korenjak.pdf
LR(1) grammars/languages ---NOT to be confused with LL(1)--- are the sub-class of all those LR(k) grammars/languages for which k=1. In this paper, which is based on Knuth's work, Korenjak explains that LR(1) parsing is much simpler than LR(k) parsing but still "good enough" for many practical application cases. What Korenjak is calling a 'processor' in this paper is actually a parser; thus please do not get confused about the terminology.
Dahlhaus.pdf
This paper by Dahlhaus and Warmuth explains nicely why Context-SENSITIVE Grammars are NOT used for compiler construction! Even in those cases, in which the word-membership problem is (still) decidable, the decision procedure would be far too 'expensive' in run-time: the compiler would be too slow and thus no longer user-friendly.
Hoogeboom.pdf
Some more background theory for you on the topic: "Undecidable Problems for Context-free Grammars".
Theory_Lecture_13-15.pdf
Slide show from another university: Theory of Formal Languages. Use this as a "reminder" of what you had seen in COS210 last year.
Lecture20JFPOST.pdf
"Refresher" slide-show on some topics Theory of Computation, compiled by Jeanne Ferrante. It is presumed that students of COS341 are reasonably familiar with these topics from earlier courses.
Practical Project - Practical Project: Task Specifications
Test Cases
Part 00 Test Cases
Test cases used to mark part 00
Part 01 Test Cases
test case files for part 01
Part 02 Test Cases
test case files for part 02
Part 03 Test Cases
test case for part 03
Part 04 Test Cases
test cases for part 04
Task 05 Test Cases
test cases for part 05
05.pdf
Task Booklet for: Code Generation.
04.pdf
Sepcification for task 04
03.pdf
Practical Task Booklet for: Type Checking.
02.pdf
Practical Task booklet for: Static Semantic Analysis / Scope Analysis / Symbol Table.
01.pdf
This project file contains the 'SPL' grammar, for which a parser must be written, together with some further instructions and advice.
00.pdf
The project has started! In this task booklet you can find your first instructions. More will follow later. I wish you happy working :)
Overview: Semester Project
This slide show gives you a 'top-level' overview of what you will have to do in your semester project. Further task details will be provided as the semester continues.
BASIC Interpreter
Interpreter to be used for task 05.
Documentation Requirements
Details about expected information for practical documentation.
Scope Design
Design decision for the scope checker.
Marks - Mark Sheets (anonymised)
marks-part00.pdf
The points are "out of 5".
marks-part01.pdf
marks for part 01
part02marks.pdf
part 02 marks
part 03 marks
mark sheet for part 03
part 04 marks
part 04 marks
part 05 marks
marks for part 05
marks-before-EO2.pdf
Description: Accumulated Semester Marks, out of 60, BEFORE EO2. Students who have 20/60 need a Distinction in EO2 to pass the course. For students with a mark SMALLER than 20/60, participation in EO2 is NOT recommended: Rather focus your study-efforts onto other courses in which you still have a better chance! Students who are already at 50/60 (or higher) are still obliged to participate in EO2!
EO1 Semester Test - The Task Sheet will appear here on the 1st of June at 17h30!
semestertest2020.pdf
PDF version of the EO1 semester test specification.
semestertest2020.pps
PowerPoint version of EO1 semester test specification.
6A.pdf
Help slides to Chapter 6: Part A.
6B.pdf
Help slides to Chapter 6: Part B.
6C.pdf
Help slides to Chapter 6: Part C.
6D.pdf
Help slides to Chapter 6: Part D.
6E.pdf
Help slides to Chapter 6: Part E.
Trans-Example.pdf
Related to Chapter #6. The slide-show explains how Target Code is generated recursively from the Abstract Syntax Tree and the Symbol Table.
Some_remarks_to_Chapter-7.pdf
This slide show (13 slides) provides some additional remarks and comments to chapter #7 of our book. Read the slide show first, then chapter #7, and thereafter the slide show once again.
8RegAlloc.pdf
Help slides to Chapter 8: including the recursive set development to the fix-point.
8DepGraph.pdf
Help slides to Chapter 8: yet another graph colouring example.
9_help-slides.pdf
Help-slides to Chapter 9.

Module forums

The new CS forums are available here.

Module Links

"In formal language theory, a context-free grammar (CFG) is a certain type of formal grammar: a set of production rules that describe all possible strings in a given formal language..."
"In computer science, an LL parser (Left-to-right, Leftmost derivation) is a top-down parser for a subset of context-free languages. It parses the input from Left to right, performing Leftmost derivation of the sentence..."
"In computer science, LR parsers are a type of bottom-up parser that analyses deterministic context-free languages in linear time..."
"In the formal languages of computer science and linguistics, the Chomsky hierarchy (occasionally referred to as the Chomsky-Schützenberger hierarchy) is a containment hierarchy of classes of formal grammars..."
"In formal language theory, a context-free grammar G is said to be in Chomsky normal form (first described by Noam Chomsky) if all of its production rules are of the form: ..."
"In formal language theory, a context-free grammar is in Greibach normal form (GNF) if the right-hand sides of all production rules start with a terminal symbol, optionally followed by some variables..."
"A context-sensitive grammar (CSG) is a formal grammar in which the left-hand sides and right-hand sides of any production rules may be surrounded by a context of terminal and nonterminal symbols. Context-sensitive grammars are more general than context-free grammars..."
"In automata theory, the class of unrestricted grammars... is the most general class of grammars in the Chomsky hierarchy... for every unrestricted grammar G there exists some Turing machine capable of recognizing L(G) and vice versa..."

Login

Username:
Password:
Remember Me

Module Description

THIS WEB PAGE IS THE STUDY GUIDE for COS341: COMPILER CONSTRUCTION. Please carefully take note of all further announcements which will appear on this web page! In COS341 we follow ...

Show Long Description

Lecturer Information

Course Coordinator

Prof Stefan Gruner

Lecturers

Assistant Lecturers

Tutors

Mr Letanyan Arumugam

Teaching Assistants

There are no teaching assistants assigned.

Class Representatives

Active Assignments

No currently active Assignments.
Check the assignment portal:
assignments.cs.up.ac.za

Active Fitch Fork Assignments

No currently active Fitch Fork Assignments
Check the assignment portal:
assignments.cs.up.ac.za

Active Bookings

    No bookings available

Lab Bookings

    No lab bookings available

Active Team Allocations

    No team allocations available

Active Bids

Individual Bids

    No individual bids

Team Bids

    No team bids

Team Pages

Team Pages

    No Team Pages

Team Pages Open to Module Members

    No Public Team Pages

Team Pages Open to Everyone

    No Public Team Pages

Active Polls

How is it going with home-studying during COVID19?


I am coping: Still in good spirit
I am struggling: The situation is very difficult
Cannot cope any more: Feeling overwhelmed

All content copyright © Department of Computer Science, School of IT, University of Pretoria, South Africa