Java代写 | CS2CO16 Programming exercise Compilers

本次Java代写是实现一个简易的编译器

DEPARTMENT OF COMPUTER SCIENCE
SUMMATIVE COURSEWORK ASSIGNMENT BRIEF
KEY INFORMATION
• Module title: Compilers
• Module code: CS2CO16
• Lecturer responsible: Dr Martin Lester
• Type of assignment: Programming exercise
• Individual/group assignment: Individual
• Weighting of the assignment: 30%
• Page limit/word count: 5 pages A4 (excluding cover sheet)
• Expected hours spent on this assignment: 10 hours in practicals + 10 hours independently
• Items to be submitted: .tar.gz or .zip source code archive + PDF written report
• Work to be submitted on-line via Blackboard Learn by: 12:00 midday on Fri 27th Mar 2020
• Work will be marked and returned by: Tue 21st Apr 2020
PLAGIARISM
By submitting this assignment, you are certifying that it is all your own work. Any sentences, figures,
tables, equations, code snippets, artworks and illustrations in this report must be original and must
not have not been taken from any other person’s work, except where explicitly acknowledged, quoted,
and referenced. You understand that failing to follow this requirement will be considered plagiarism.
Plagiarism is a form of academic misconduct and will be penalised accordingly. The University’s
Statement of Academic Misconduct is available on the University web pages.
LATE SUBMISSION
If your work is submitted after the deadline, 10% of the maximum possible mark will be deducted for
each working day (or part thereof) it is late. A mark of zero will be awarded if your work is submitted
more than 5 working days late. It is strongly recommended that you hand work in by the deadline as a
late submission of one piece of work can have an impact on other work. If you believe that you have a
valid reason for failing to meet a deadline, then you should complete an Extenuating Circumstances
Form and submit it to the Student Support Centre before the deadline, or as soon as is practicable
afterwards, explaining why.
1
1. ASSESSMENT CLASSIFICATIONS
This coursework assesses your ability to understand, explain and modify a compiler.
You will gain credit for:
• writing code that compiles and:
– correctly implements the features requested;
– where requested, includes tests to check its correctness;
– contains sensible comments and is easy to understand;
– is elegant and idiomatic;
• writing a report that:
– explains what you did and why;
– includes evidence (such as code excerpts and output from your program) to support your
claims;
– uses clear, correct English and is structured clearly.
Your assignment will be marked according to the mark scheme outlined in Section 4. The mark scheme
is designed so that the mark obtained in this way will correspond to the following qualitative degree
classification descriptions:
Degree Classification Description
First Class (>= 70%) Excellent
Upper Second Class (60-69%) Good
Lower Second Class (50-59%) Satisfactory
Third Class (40-49%) Poor
Pass (35-39%) Very Poor
Fail (0-34%) Inadequate
2
2. ASSIGNMENT DESCRIPTION
SUMMARY
You will be supplied with a simple compiler babycino for a subset of Java, similar to Appel and
Palsberg’s subset MiniJava. The compiler supports boolean AND (&&), but not boolean OR (||).
Modify the compiler to add support for ||. Test your compiler to check it works correctly. Write a
report describing what you did and explaining why. Include listings of the code you modified in your
report.
In your PDF report, you must answer each subtask on a separate page and use at most one page
for each subtask, except subtask 4, which may take 2 pages.
You must submit a .tar.gz or .zip archive of your code as well as your report. You will be
penalised severely for submitting code that does not compile.
TASK DESCRIPTION
The babycino compiler discussed in lectures supports boolean AND (&&), but does not support
boolean OR (||). You will find an explanation of || in any Java language reference, but note the
following:
The binary operator || is left-associative and (point 1) has lower precedence than &&. The expression
b1 || b2 evaluates to true if at least one of b1 and b2 is true; otherwise, (point 2) it evaluates
to false. Note that, like &&, || short-circuits. If b1 is true, there is no need to evaluate b2 to
determine the result. Therefore, the language guarantees: (point 3) that b1 is evaluated before b2; and
(point 4) that if b1 is true, then b2 will not be evaluated.
Your task is to add support for || to the compiler. You will need to consider carefully how best to
modify each stage of the compiler (if at all).
Subtask 1: Parsing (20%)
Modify the compiler to parse || expressions. Make sure that your compiler conforms to points 1 in
the specification above.
In your report:
1. Show the code that you changed. (10%)
2. Explain the changes that you made. (5%)
3. Include a short, valid MiniJava program that contains a single || expression and a diagram of
the parse tree generated by your compiler for that program. (5%)
Subtask 2: Semantic analysis (20%)
Ensure that your compiler rejects ill-formed || expressions.
In your report:
1. Show the code that you changed. (10%)
2. Explain the changes that you made. (5%)
3
3. Include a short MiniJava program that contains an ill-formed || expression, which the compiler
rejects during the semantic analysis phase. (5%)
Subtask 3: Code generation (20%)
Modify the compiler to generate code for || expressions. You might like to check that your compiler
correctly evaluates || for different combinations of true and false. Make sure that your compiler
conforms to points 2, 3 and 4 in the specification above.
In your report:
1. Show the code that you changed. (10%)
2. Explain the changes that you made. (5%)
3. Include the unoptimised intermediate code generated by the compiler for the short MiniJava
program in subtask 1. (5%)
Subtask 4: Testing (20%)
Write short MiniJava programs to test points 1, 2, 3 and 4 in the specification above.
Each program should produce some output and terminate. In order to be a useful test for part of the
specification, the output of the program should be different for a compiler that does not satisfy that
part of the specification.
In your report:
1. Show the code for the tests for each of the numbered specification points. (3% * 4)
2. State the expected output, both for a compiler that does satisfy the specification and one that
does not. (2% * 4)
If you are unsure what the correct behaviour of your compiler should be, you may find it helpful to
recall that a MiniJava program should behave the same whether it is compiled by a MiniJava compiler
or a Java compiler. If you find that your compiler does not behave as it ought to, fix it!
Presentation of code archive and report (20%)
This assignment is partly an exercise in technical report writing. Marks will be awarded for writing
clear, correct English. Marks will also be awarded for structuring your report clearly with consistent
use of style, but not for fancy formatting.
With regard to the code archive, you should make sure you include the supplied scripts to build and
test your compiler automatically. You should also follow a sensible naming convention for files and,
where appropriate, organise your files neatly into different directories. Your archive should not include
any temporary files or caches. The code itself should be sensibly formatted and commented.
4
ADDITIONAL INFORMATION
Resources Supplied or Required
You will be able to download the babycino compiler from Blackboard. The compiler uses the
ANTLR parser generator from www.antlr.org. ANTLR and its libraries are included in the babycino
archive, so you do not need to download them separately, but you may find it helpful to look at the
ANTLR documentation.
You may use workstations on campus or your own computer. Please take care to backup your work
periodically. An easy way to achieve this is to use an online source control system, such as GitLab.
The lecture notes on Blackboard provide an overview of how to write a compiler. You may also find
the resources on the module reading list helpful.
Practicals
There are 5 x 2-hour practicals timetabled for completing this coursework. These will be held in
Polly Vacher G56 on Tuesdays, 11:00-13:00, in Weeks 6-11 of term. You are advised to attend these
practicals, as this will be the easiest way to obtain support. The lecturer and student demonstrators will
be available to help. Please ask us if you are stuck. We will not tell you exactly what to do, but we will
try to provide you with guidance.
You may also wish to discuss the coursework with other students in practicals. This is both permitted
and encouraged, but please remember that this is individual coursework. Every line of code you write
and every sentence in your report must be your own work. Working together with a friend on the same
computer or copying code (through any means) is likely to constitute plagiarism.
To stay on target to submit by the deadline, you should aim to complete one task in every practical and finish writing up the corresponding page of the report before the following practical.
You will then be able to seek guidance on any remaining problems in the final practical.
Please ask questions about coursework in practicals if you can, but you are also welcome to ask
questions during the lecturer’s drop-in office hours or, if he is available, after lectures.
5
3. ASSIGNMENT SUBMISSION REQUIREMENTS
FRONT PAGE
The first page of your submission should include the following information:
• Module code: CS2CO16
• Assignment report title: Adding boolean OR to a compiler
• Student Number (for example, 25098635):
• Date of completion:
• Actual time spent on the assignment (hours):
• Assignment evaluation (3 key points):
1.
2.
3.
We will use information about how long you spent on the assignment when we review and balance
coursework between modules for later years. An exact answer is not necessary, but please try to give a
reasonable approximation.
The assignment evaluation is your opportunity to provide feedback on the assignment. We will use this
to improve the coursework for next year. You might like to comment on the following:
• Were any parts of the assignment particularly fun, interesting, boring or frustrating?
• Was the assignment too long/short/easy/hard/about right?
• Were there any obvious errors or technical problems with the materials supporting the assignment?
You will not be penalised for making negative comments about the coursework assignment in the
assignment evaluation.
ASSIGNMENT CONTENT
For this assignment, you are required to submit both a report and source code through Blackboard,
following the instructions at the submission point. You should submit your report as a PDF and your
code as a .tar.gz or .zip archive.
Please check carefully that the code in your archive compiles. If your code does not compile, but
can be made to do so with a minor modification, you will lose marks for code presentation. If your
code still does not compile, you will score zero for all code components of the assignment, making
your maximum possible mark around 50%.
Answer each subtask on a separate page and use at most one page for each subtask, except
for subtask 4, which may use 2 pages. If you fail to do so, you will lose marks for presentation.
Furthermore, if your answer for a subtask is significantly longer than permitted, you will gain credit
only for the first page of your answer. The minimum permissible font size for the body text of your
report is 10 pt; 12 pt is recommended. For code excerpts, you will probably need to use a smaller font,
which is fine.
6
4. MARKING SCHEME
Marks available for the assignment are subdivided as shown below. The letter after each component
(A, B or C) indicates the marking scale that will be used.
1. Page 1: Parsing (20%)
1. Code. (10%, A)
2. Explanation. (5%, B)
3. Test case and parse tree diagram. (5%, A)
2. Page 2: Semantic analysis (20%)
1. Code. (10%, A)
2. Explanation. (5%, B)
3. Test case. (5%, A)
3. Page 3: Code generation (20%)
1. Code. (10%, A)
2. Explanation. (5%, B)
3. Unoptimised intermediate code for test case. (5%, A)
4. Pages 4-5: Testing (20%)
1. Test case: Precedence. (5%, C)
2. Test case: Both arguments false. (5%, C)
3. Test case: Evaluation order. (5%, C)
4. Test case: Short-circuiting. (5%, C)
5. Presentation (20%)
1. Layout of files in code archive. (5%, B)
2. Formatting/commenting/style of code. (5%, B)
3. Layout and formatting of report. (5%, B)
4. Correctness and clarity of English. (5%, B)
A. Code and compiler output
Full marks will be awarded if the code, test case or output is complete and correct. Marks will be
deducted for errors, according to the severity of the error.
B. Explanations and presentation
Up to 5% will be awarded, depending on the quality of your work:
• 0% – inadequate
• 2% – poor
• 3% – good
• 5% – excellent
C. Test cases
Of the 5% available:
• 3% for a test case that distinguishes between a correct and incorrect compiler.
• 1% for stating what the output is for a correct compiler.
• 1% for stating what the output is likely to be for an incorrect compiler.
7


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论