-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreadme-project-2.html
76 lines (74 loc) · 5.66 KB
/
readme-project-2.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
<!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 2: Semantic Checking</h1>
<p>In
this stage of the project we are doing the work described
in Chapter 5 of the book. The goal of this stage is to
produce (and test) a semantic checker for MiniJava. It accepts a parsed
MiniJava program (AST) as input and verifies whether the AST is a valid
Java program (i.e., a program that is ok according to the type and
scoping rules of the language). </p><p>If
the program passes by the type checker it should mean that the program
is "correct" in the sense that it can be compiled and run (but it
doesn't, of course, make any guarantees that the program has no bugs).</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 backup copy of
your phase 1 project. Otherwise you run the risk of overwriting any
changes you have made to some of the files that were provided in phase
1.</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. You may in fact
chose to change these tests. For example, in this project a file
TestTypeCheckPhase1Internal.java tests the stage that builds the symbol
table. As such it is dependent on
specific choices of how you chose to represent the symbol table. Later
stages of the compiler may (and probably will) depend on some of these
details. However, we want you to explicitly think about what goes into
the symbol table, and to have the freedom to choose your own
implementation strategy. <span style="font-weight: bold;"><span style="font-weight: bold;"></span></span></p><p>The project contains the same files from the phase 1 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.test.typechecker:</span> JUnit tests for this phase of the project.</li></ul><ul><li><span style="font-weight: bold;">minijava.typechecker:</span> Some starter code provided for you.</li><li><span style="font-weight: bold;">minijava.typechecker.implementation: </span>
You should create this package. The intention is to put (as much as it
is possible / reasonable) all the code implementing your type checker
in this package.</li><li><span style="font-weight: bold;">minijava.util: </span>there
are two classes ImpTable and FunTable that may be useful to implement
symbol tables. You don't have to use them (e.g., maybe you prefer to
simply use java.util.HashMap or java.util.TreeMap instead, or implement something yourself).</li><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>Many classes in the starter code are heavily commented and provide explanation about the code. In particular, the following
are good places to start:</p>
<ul><li>The README_stage2 file at the toplevel of the src directory.</li><li>The files in the package <span style="font-weight: bold;">minijava.typechecker</span>.</li><li>The comments in the<span style="font-weight: bold;"> minijava.test.typechecker</span> tests.<span style="font-weight: bold;"></span></li><li>You should also read Chapter 5 of the textbook.</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.typechecker.implementation</span> package.</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_stage2.txt file</span>. </p><p>The name of this project stage for the electronic handin is <b>
project2</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>
</p></body></html>