|
1 | 1 | #lang scribble/manual |
2 | | -@title[#:tag "Assignment 6" #:style 'unnumbered]{Assignment 6: Syntax Checking} |
| 2 | +@title[#:tag "Assignment 6" #:style 'unnumbered]{Assignment 6: Squid Game} |
3 | 3 |
|
4 | 4 | @(require (for-label (except-in racket ...))) |
5 | 5 | @(require "../notes/ev.rkt" |
6 | 6 | "../notes/utils.rkt") |
7 | 7 |
|
8 | | -@bold{Due: Thursday, May 5th, 11:59PM EDT} |
| 8 | +@bold{Due: Monday, Nov 14, 11:59PM EST} |
9 | 9 |
|
10 | | -The goal of this assignment is to add syntax checking to our compiler. |
| 10 | +The goal of this assignment is to hone your testing skills. |
11 | 11 |
|
12 | | -You are given a repository with a starter compiler similar to the |
13 | | -@seclink["Mountebank"]{Mountebank} language we studied in class. You |
14 | | -are tasked with: |
| 12 | +@section[#:tag-prefix "a6-" #:style 'unnumbered #:tag "game"]{The Game} |
15 | 13 |
|
16 | | -@itemlist[ |
17 | | - |
18 | | -@item{implementing compile-time syntax checking.} |
19 | | - |
20 | | -] |
21 | | - |
22 | | -@section[#:tag-prefix "a6-" #:style 'unnumbered #:tag "checking"]{Syntax Checking} |
| 14 | +The autograder for this assignment includes a collection of compilers |
| 15 | +that implement @secref["Assignment 5"] and a reference interpreter. |
23 | 16 |
|
| 17 | +You must submit a list of programs that will be run on each compiler. |
| 18 | +If a compiler produces a result that is inconsistent with the |
| 19 | +reference interpreter, it is eliminated. Your goal is to construct |
| 20 | +a set of test programs that eliminate the largest number of compilers. |
| 21 | +The player that eliminates the largest number of compilers, wins. |
24 | 22 |
|
25 | | -Up until now, we've written our compiler assuming that programs are |
26 | | -well-formed, but there has never been any code that actually checks |
27 | | -this assumption. The assumptions go beyond the properties checked |
28 | | -during parsing. For example, our parser will happily accept a program |
29 | | -like @racket[(lambda (x x) x)], and the compiler will emit code for it |
30 | | -even though this is not a well-formed program. |
| 23 | +When you submit, choose a name to display on the leaderboard. It does |
| 24 | +not need to be your real name, but please keep it appropriate for this |
| 25 | +setting. |
31 | 26 |
|
32 | | -The idea of this assignment is to implement a function, defined in |
33 | | -@tt{check-syntax.rkt}: |
| 27 | +After submitting, click "Leaderboard" to see the latest standings. |
34 | 28 |
|
35 | | -@#reader scribble/comment-reader |
36 | | -(racketblock |
37 | | -;; Prog -> Prog |
38 | | -(define (check-syntax p) ...) |
39 | | -) |
| 29 | +There are 133 compilers included. Your score will be the number of |
| 30 | +compilers you are able to eliminate, with a maximum score of 100. |
40 | 31 |
|
41 | | -If the program is well-formed, it should behave like the identity |
42 | | -function, returning the same program it was given as input. On |
43 | | -ill-formed programs, it should signal an error using @racket[error]. |
| 32 | +We reserve the right to update the reference interpreter and will |
| 33 | +announce any changes on Discord. |
44 | 34 |
|
45 | | -For the purposes of this assignment, the quality of the error messages |
46 | | -doesn't matter, although in real programming language implementations, |
47 | | -good error messages are crucial. |
48 | | - |
49 | | -Here are the properties that should be checked of each program: |
| 35 | +The following updates have been made since the release: |
50 | 36 |
|
51 | 37 | @itemlist[ |
52 | 38 |
|
53 | | -@item{Programs are @emph{closed}; there are no unbound variables in |
54 | | -the program.} |
| 39 | +@item{The interpreter now checks for integer overflow and crashes when |
| 40 | +this happens, thereby making overflow behavior unspecified for the compilers.} |
| 41 | + |
| 42 | +@item{The interpreter now crashes when interpreting unbound variables |
| 43 | +instead of producing @racket['err], making unbound variable behavior |
| 44 | +unspecified.} |
55 | 45 |
|
56 | | -@item{Every @racket[define]d function should have a distinct name.} |
| 46 | +] |
57 | 47 |
|
58 | | -@item{Every function parameter should be distinct from the other |
59 | | -parameters of that function.} |
| 48 | +Submissions should be written using the following format: |
60 | 49 |
|
61 | | -@item{Every function's name should be distinct from all of its |
62 | | -parameters' names.} |
| 50 | +@codeblock|{ |
| 51 | +#lang info |
| 52 | +(define programs |
| 53 | + (list |
| 54 | + '[ (add1 1) ] |
| 55 | + '[ (write-byte 97) ] |
| 56 | + '[ (define (f x) (+ x x)) (f 5) ])) |
| 57 | +}| |
63 | 58 |
|
64 | | -@item{Every function name and variable should not clash with any of |
65 | | -the keywords of our language, e.g. @racket[lambda], @racket[if], etc. |
66 | | -(Note this is not a restriction Racket puts on programs; the following |
67 | | -is a perfectly reasonable expression: @racket[(λ (λ) λ)], but we'll |
68 | | -consider this a syntax error.)} |
| 59 | +If you'd like to include a program reads data from the standard input |
| 60 | +port, you can add an enties which are two-element lists, where the first |
| 61 | +element is a string that is used as the contents of the input port |
| 62 | +and the second element is the program, for example: |
69 | 63 |
|
70 | | -@item{Every pattern variable in a pattern should be distinct. (Racket |
71 | | -also allows this, but it has a complicated run-time semantics which we |
72 | | -don't implement so instead we just rule out these programs.)} |
| 64 | +@codeblock|{ |
| 65 | +#lang info |
| 66 | +(define programs |
| 67 | + (list |
| 68 | + '[ (add1 1) ] |
| 69 | + '[ (write-byte 97) ] |
| 70 | + '[ "abc" [ (read-byte) ]] |
| 71 | + '[ (define (f x) (+ x x)) (f 5) ])) |
| 72 | +}| |
73 | 73 |
|
74 | | -] |
75 | 74 |
|
76 | | -The starter code calls @racket[check-syntax] in both |
77 | | -@tt{compile-file.rkt} and @tt{interp-file.rkt}. The definition of |
78 | | -@racket[check-syntax] is stubbed out in @tt{check-syntax.rkt}. |
| 75 | +You may add as many programs as you'd like to the file. |
79 | 76 |
|
80 | | -There are tests included in @tt{test/check-syntax.rkt}. You can also use this file |
81 | | -to write your own tests for debugging. |
82 | 77 |
|
83 | 78 | @section[#:tag-prefix "a6-" #:style 'unnumbered]{Submitting} |
84 | 79 |
|
85 | | -You should submit on Gradescope. You should submit a zip file that has |
86 | | -exactly the same structure that the stub contains. We will only use |
87 | | -the @tt{check-syntax.rkt} files for grading, so make sure all your |
88 | | -work is contained there! |
| 80 | +You should submit on Gradescope. You should a single file named |
| 81 | +@tt{info.rkt} that conforms to the format shown above. |
0 commit comments