Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
COMP6580: Programming Language Implementation
In this mini-project, you will add a feature to a simple imperative programming language.
Project structure
We have prepared a basic example compiler and interpreter written in OCaml on Kent’s Git-Lab installation
https://git.cs.kent.ac.uk/mjb211/example-compiler. It compiles a simple imperative language with arrays and loops into x86-64 assembly code, or alternately, can interpret these programs. You will implement a parallel assignment feature, explained below, in the parser, type checker, and either the interpreter or the compiler (your choice).
What to hand in
Submit on Moodle a .zip file of the compiler source files that you modified, and a (maximum) 1-page document explaining what you did, and to what extent your project works or does not work and why.
Parallel assignment
Add a new kind of statement whose syntax is as follows.
identifiers ::=
| identifier
| identifier identifiers
atomic_exps ::=
| atomic_exp
| atomic_exp atomic_exps
stmt ::=
...
| parallel identifiers := atomic_exps
This will require modifying the lexer with the new keyword parallel, and also extending the abstract syntax and parser for the new non-terminals and statement form. The type checkershould be extended to check parallel assignments: the number of identifiers must be the same as the number of atomic expressions, and each identifier should have the same type as its corresponding expression.
To update the compiler (if this is your choice), you should add a new compilation pass that runs immediately after type checking and converts each parallel statement into a sequence of normal assignments. To update the interpreter (if this is your choice), the interp_stmt function will need to be extended with an extra case for parallel.
The semantics of parallel assignment is that each variable is assigned the value of the corresponding expression, and that all of the assignments happen at the same time, after the expressions are evaluated. For example, after running the following statements, the value in x is 301, in y is 21, and in z is 2.
x := 1
y :=
20 z
:= 300
parallel x y z := (z + 1) (y + 1) (x + 1)
Late or non- submission of coursework
The penalty for late or non submission of coursework is normally that a mark of zero is awarded for the missing piece of work and the final mark for the module is calculated accordingly.
Plagiarism and duplication of material
Senate has agreed the following definition of plagiarism: ‘Plagiarism is the act of repeating the ideas or discoveries of another as one’s own. To copy sentences, phrases or even striking expressions without acknowledgement in a manner that may deceive the reader as to the source is plagiarism; to paraphrase in a manner that may deceive the reader is likewise plagiarism. Where such copying or close paraphrase has occurred the mere mention of the source in a bibliography will not be deemed sufficient acknowledgement; in each such instance it must be referred specifically to its source. Verbatim quotations must be directly acknowledged either in inverted commas or by indenting.’ The work you submit must be your own, except where its original author is clearly referenced. We reserve the right to run checks on all submitted work in an effort to identify possible plagiarism, and take disciplinary action against anyone found to have committed plagiarism. When you use other people’s material, you must clearly indicate the source of the material using the Harvard style (see
http://www.kent.ac.uk/uelt/ai/styleguides.html).
In addition, substantial amounts of verbatim or near-verbatim copy-and-paste from web-based sources, course material and other resources will not be considered as evidence of your own understanding of the topics being examined.
The School publishes an on-line Plagiarism and Collaboration Frequently Asked Questions (FAQ) which is available at: