forked from DennisTT/cpsc411project5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme-project-3.html
104 lines (103 loc) · 10.3 KB
/
readme-project-3.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>CS411 - MiniJava Project</title>
<style type="text/css">
p, table, li, h1, h2, h3 {
font-family: verdana,arial,'sans serif';
}
p, h1, h2, h3, table, li, hr {
margin-left: 10pt;
}
body {
}
p, li {
font-size: smaller;
}
pre {
margin-left: 30pt;
}
</style></head>
<body>
<h1>CPSC 411 - Stage 3: Translation to IR</h1>
<p>In
this stage of the project we are doing the work described
in Chapter 6, 7 and 8 of the book. The goal of this stage is to
produce (and test) a Translator that tranforms a typechecked AST into IR
code that is ready to be turned into Assembly code by the next
stage. </p><p>This transformation (from AST to "easy to assemblify" IR) happens in several steps.</p><ol><li>Transform the AST into a kind of "free form" IR.</li><li>Transform the "free form" IR into linearized IR.</li><li>Transform linearized IR into a list of basic blocks.</li><li>Do trace scheduling to optimize JUMPs and produce IR that has CJUMPS easy to generate code for.</li></ol><p>Step
1 is described in chapter 7 of the book. Steps 2, 3 and 4 are described
in Chapter 8. A complete implementation of Steps 2, 3 and 4 where
provided on the book's website. In the same spirit, this project drop
contains working implementations of these steps. That leaves step 1 for
you to implement.</p><h2>Project Setup</h2><p><span style="font-weight: bold; color: red;">Warning:</span>
Before installing the new files, it is advisable to make a backup copy of
your project. Otherwise you run the risk of overwriting any
changes you have made to some of the files that were provided in phases
1 and 2.</p><p>The
zip file in which these instructions are contained is an archived copy
of an Eclipse project. To import this project into Eclipse do as
follows:</p><ol><li>Select "File > Import" Menu.</li><li>Select "General > Existing Projects into Workspace".</li><li>Select "Select Archive file" and Browse for this .zip file.</li><li>Select the project and click "Finish".</li></ol><p>The project is set up with a number of JUnit tests. The provided tests should be thought of as an <span style="font-weight: bold;">executable specification</span>. This means that<span style="font-weight: bold;"> you should not change any code in the test classes</span>. Otherwise
you are free to change any and all code in the project. We also
encourage you to create additional tests, to more thoroughly test your
solution.</p><p>Test classes<span style="font-weight: bold;"><span style="font-weight: bold;"> </span></span>who's
name contains the word "Internal" are an exception to the "don't change
the tests" rule. These tests are intended to test a chunk of
functionality that is "internal" to your solution. <span style="font-weight: bold;"><span style="font-weight: bold;"></span></span></p><p>The project contains the same files from the phase 2 starter and the following new files:</p><ul><li><span style="font-weight: bold;">src </span></li><ul><li><span style="font-weight: bold;">minijava.util: </span>The
class List provides a versatile implementation of lists that works
either as linked or array style list. This is used to represent various
lists of IR code.<span style="font-weight: bold;"></span></li><li><span style="font-weight: bold;">minijava.test.translate:</span> JUnit tests for this phase of the project.</li><ul><li>TestX86Frame and TestTranslate: your job :-)</li><li>The other tests: should pass if TestTranslate passes (unless the provided code in the canon package is broken)</li></ul><li><span style="font-weight: bold;">minijava.ir:</span> contains several subpackages related to manipulating / representing IR trees.</li><ul><li><span style="font-weight: bold;">frame: </span>corresponds to the Frame package from the book.</li><li><span style="font-weight: bold;">frame.x86: </span> this
is where you should implement X86 specific version of stuff in the frame
package (as described in chapter 6 of the book).</li><li><span style="font-weight: bold;">temp:</span> representation of Temps and Labels.</li><li><span style="font-weight: bold;">tree:</span> representation of IR trees.</li><li><span style="font-weight: bold;">canon:</span> Chapter 8 algorithms to massage IR into a manageable form.</li><li><span style="font-weight: bold;">interp:</span> Contains code implementing an IR interpreter, used to simulate execution of IR (so we can test whether the generated IR works).</li></ul></ul><ul><li><span style="font-weight: bold;">minijava.translate:</span> Some starter code provided for you.</li><li><span style="font-weight: bold;">minijava.translate.implementation: </span>
You should create this package. The intention is to put (as much as it
is possible / reasonable) all the code implementing the translator in this package.</li></ul><li><span style="font-weight: bold;">sample: </span>a
.out file containing the expected output for each sample program has
been added. (This is used by the unit tests to check the actual output).</li></ul><h2>Inheritance</h2><p>The
implementation of inheritance in MiniJava is optional. We may come back
to this later if we have time to cover the material from Chapter 14 of
the textbook. You may attempt to implement inheritance support if you like an extra challenge.</p><ul><ul><span style="font-family: verdana,arial,'sans serif';"></span></ul></ul>
<h2>How to get started</h2><span style="font-family: verdana,arial,'sans serif';"></span><p>I suggest you work as follows:</p>
<ul><li>Fill in your names in the README_stage3 file at the toplevel of the src directory.</li><li>Read Chapter 6 of the book and implement your X86Frame class (some tests are in TestX86Frame.java).</li><li>Then read Chapter 7 of the book and work on passing TestTranslate.</li><li>Once
TestTranslate passes, the other test should also pass, since you have
been provided with working implementations of the Chapter 8 algorithms
in <span style="font-weight: bold;">minijava.ir.canon</span> package<span style="font-weight: bold;">.</span></li><li>The classes in <span style="font-weight: bold;">minijava.ir.canon </span>implement
the algorithms from Chapter 8. Though you can probably finish the
assignment without understanding these, you will be expected to know
these algorithms for the final exam. If you want to really understand
how these work, a good exercise is to reimplement them from scratch by
yourself. This is however entirely optional. (Since I have not actually
gotten round to "OO-iffying" the Canon.java code yet, working on a
clean implementation of this one in particular would be very useful :-)</li></ul><p>One
further note: although you are allowed to change all code except
for the tests, this does not mean that you actually have to change any
code at all! In fact, you can complete this assignment by only adding code in the <span style="font-weight: bold;">minijava.translator.implementation</span> and <span style="font-weight: bold;">minijava.ir.frame.x86</span> packages.</p><h2>Handing In</h2>
<p>Only one of the team members should hand in for your team. <span style="font-weight: bold;">Make sure you have filled in the names of each team member in the src/README_stage3.txt file</span>. </p><p>The name of this project stage for the electronic handin is <b>
project3</b>. Please use the <a href="http://www.cs.ubc.ca/ugrad/facilities/windows/handin.shtml">handin
web-interface</a>.</p>
<p>You should handin the entire contents of your project's src
directory, excluding the test files. We have provided a <span style="font-weight: bold;">build.xml</span> script in the src directory that packages up the correct files in a .zip file. <span style="font-weight: bold;">Please use this script</span>, it will ensure a uniform layout for all handed in materials, which makes it easier for the TA.</p><h3>Copying and Plagiarism Policy</h3><span style="font-family: verdana,arial,'sans serif';"></span><p>Please read the departmental policy on Plagiarism and Collaboration <a href="http://www.cs.ubc.ca/about/policies/collaboration.shtml">here</a>.</p><p>Plagiarism
means passing of someone else's work as your own. Plagiarism is a
serious offense and dealt with quite harshly by the
university. Suspected cases are forwarded to the Dean's office and can
result in suspension from the university as well as an entry on your
academic transcript.</p><p>The key to using other people's code without
commiting plagiarism is to make it absolutely clear how much of
your assignment is your own work and how much it is based on someone else's
work. When copying something, or adapting it as part of your solution, <span style="font-weight: bold;">you are fully responsible to provide clear references to your</span> <span style="font-weight: bold;">sources</span>, <span style="font-weight: bold;">and to what extent your solution is based on these sources</span>. Code comments are a good way to do that for programming assignments.</p><p>For
the MiniJava project you will work in teams. It is expected that the
work submitted as a team is collaborative work. As such we will treat
the code as being developed by all team members together. We do not
require you to provide comments about the details of exactly which team member wrote
every single line of code. However, if we suspect
there is an imbalance in the contributions made by each team member, we
may ask for clarification and we may reflect this imbalance in your
final marks. </p><p>You are not supposed to copy code or
otherwise collaborate with people other than those on your own project team. If
you do, then you can still submit your work for partial credit,
provided that you provide adequate documentation of your sources and
the extent to which your solution is derived from them.</p><p>When
you are provided starter code, as is the case in most of our assignments and project drops, it is
automatically assumed that you did not write the starter code yourself.
It is therefore not necessary to provide explicit documentation to explain this
obvious fact. On the other hand, it is automatically assumed that <span style="font-weight: bold;">you
are claiming any code that differs from the original starter code as
entirely your own work. If this is not the case, you are fully
responsible to provide a clear and complete explanation of this fact.</span> Any failure to do so will be considered academic misconduct. Forgetfulness is not an excuse.</p></body></html>