Homework 7
Last updated: Wed, 15 Nov 2023 18:17:39 -0500
Out: Mon Nov 13, 2023, 00:00 EST
Due: Sun Nov 19 (really Wed Nov 22), 2023, 23:59 EST
Overview
In this assignment, we’ll continue extending the "CS450js Lang" programming language that we started in class.
This hw will be graded as follows:
correctness (15 pts)
design recipe (25 pts)
style (8 pts)
README (2 pts)
Setup
Create a new repository for this assignment by going to the CS450 Fall 2023 GitHub Organization page and clicking "New".
Name the repository <YOUR ACCOUNT NAME>-hw7 where <YOUR ACCOUNT NAME> is your GitHub account name.
For example, if my GitHub account is cs450student then I would name my hw7 repository cs450student-hw7.
Mark the repository as Private.
Check "Add a README file".
Add a .gitignore file for "Racket" to automatically ignore temporarily files.
When done click "Create repository".
Starter Code
Here is a hw7 starter repo. In particular, it has a tests-from-lecture.rkt file that contains the test suite you all created together in lecture.
Note: This file is meant to help you test your code for correctness, but it does not replace the tests.rkt file that you must write (which must obviously be different from this file).
Submitting
1 Before Submitting
Do not submit until all code has been thoroughly tested, independent of the autograder (if there is one), and you are reasonably sure the assignment is complete and correct.
The autograder is not a software development tool so it should not be used as one.
If you submit and get an autograder error, this means the code you wrote is not complete and correct and it’s up to you to figure out why.
The course staff is here and eager to help, of course, but cannot do so without details about what has already been tried. (For example, "why is the autograder giving an error?" is not something we can help with.)
The grading criteria (i.e., test suite) is subject to change. This means that the grade on the preliminary autograder test suite (if one is provided) is not the final grade.
2 Common Problems
Common submission problems:
a required identifier is not provided or defined in the homework file
an external file has not been uploaded to GitHub
the code is in an infinite loop, e.g., do not start a big-bang loop automatically when running a file. (Instead, it should be in a main function)
3 Files
A submission must have the following files in the repository root:
hw7.rkt: Contains the hw solution code.
To properly grade the assignment, this file should provide the following:parse450js: converts a program written as a 450jsExpr to a 450jsAST
run450js: computes the 450jsResult running a "CS450js Lang" program, represented as a 450jsAST
NaN: represents a "not a number" 450jsResult value
exn:fail:syntax:cs450js?: a predicate for identifying "CS450js Lang" parse errors
All code should also follow proper Racket Style.
tests.rkt: This file should require hw7.rkt and define tests for it.
Specifically, it should define a rackunit test-suite which contains sufficient rackunit test cases (e.g., check-equal?, etc.) for each defined function.
Note: This file must be separate and different from the tests-from-lecture.rkt file that we created together in lecture.
README.md: Contains the required README information, including the GitHub repo url.
Also, the repository must have appropriate commit messages. See How to Write a Git Commit Message if you are unsure how to write a commit message.
4 GradeScope
When ready, submit this assignment to GradeScope using the "GitHub" submission feature with your hw7 repository selected.
Submission link: GradeScope HW7
HW Tasks
For this assignment, extend the "CS450js" Programming Language (that we started in lecture 19) with some Boolean values and expressions.
- Specifically, the language should extend the 450jsExpr data definition with the following items:
’true
’false
(list ’== 450jsExpr 450jsExpr)
(list ’if 450jsExpr 450jsExpr 450jsExpr)
You are allowed to subsequently refactor any data definitions however you wish.
Like the rest of the "CS450js Lang" programming language, the semantics of these new forms should follow JavaScript semantics. When in doubt, we will use the repljs.com evaluator as the official specification for the behavior of "CS450js Lang" programs.
For ==, the behavior may not be what you may initially guess, so make sure you understand how it works before beginning the assignment. It may be helpful to lookup "loose equality" in JavaScript.
For if, you should look up what a "truthy" value is and how it behaves.
As usual, make sure to update existing Data Definitions (or create new ones) first, before starting to write any code. At this point in the semester, since we are no longer creating small programs, it’s unlikely that the assignment can be completely without focusing and understanding the data representations first.
Properly following the other steps of the design recipe—
e.g., name, description, signature, examples, and tests— will also be crucial towards successful completion of this assignment.
Keep in mind:
As usual, just "trying to get the code working" will not earn a good grade on this assignment.
Also, all code must follow The Design Recipe. This means that data definitions should be created or updated to properly represent the needed data representations in the program. Further, all functions must have all the required Function Design Recipe components. In particular, you must be able to explain how you arrived at any piece of the code in the program. There should also be a test suite in a file named tests.rkt.
Functions should also be split properly so that each performs "one clear task". One way to know when this is the case is if the function is easy to name and explain concisely. Another way is if a function only processes one kind of data.
Here is (maybe) an approximation of a correct running program (to be determined).