Starting from:

$35

Project Part 2 Writing Programs in CD18 Solution

You are to write a suite of programs in the language CD18.

This part of the project has 3 main purposes
    1) To help you to learn the CD18 Programming Language.
    2) To ensure that you have the beginnings of an adequate suite of test data for the later stages of your compiler.

    3) To see if you can uncover any inconsistencies in the definition of CD18.

Your suite of programs should contain:
    a) at least one that fails syntactically (but succeeds lexically).
    b) at least one that fails semantically( but succeeds lexically and syntactically).

    c) what you consider to be the simplest possible working program in CD18.

d)    several that you expect to run successfully when later compiled by your part 5 (and also parts 3 & 4). These should include at least one that just has a main program and simple variables, one that has arrays, and one that has function(s)/procedure(s) using all three methods of parameter passing that are allowed in CD18.

    e) Write a program in CD18 that will compute the area of a polygon from a set of (x, y) Cartesian points. The program should have functions to (i) input the number of points (up to 20) and the points themselves, and (ii) compute the area of the polygon. The main program should be used to output the result. The operative formula is:

e.g.

0
0

i+1
i
i+1
i
















1
1






6
6


2
2

3
3















5
5




4
4






































The submission for Part 2 may be hand-written and scanned to a PDF, or typed as text files, and submitted via Blackboard.

No program in parts (a) to (d) need be longer than 1 page of hand-written CD18 code.
Please include comments that explain exactly what the program is doing.

Also include (separate page) comments on any inconsistencies or ambiguities that you may find in the specifications of CD18.

The marker may also require you to submit one or more of your programs as simple text files (produced from a simple editor like Notepad, Wordpad, xcoral, etc). These will then become part of a standard test suite for the whole class.

Project Part 2, is due on Friday August 24 at 23:59pm. Please zip up all your files and submit them via the Part 2 submission point within the assessments tab on Blackboard. Use a file name that contains your student number and “pt2” (e.g. c7090832_pt2.zip), and put your name into the associated comment field for the submission. Remember to incorporate an assignment cover sheet into your submission.

Keep your own copy of what you submit.




DB    v1.0 2018-08-02 (originally issued : 2018-08-02)

More products