@@ -25,8 +25,8 @@ studied in class. You are tasked with:
2525
2626@item{implementing run-time arity checking for function calls,}
2727
28- @item{extending function definition to include ``rest argument''
29- parameters for writing variable arity functions,}
28+ @item{extending function definitions to include ``rest argument''
29+ parameters for writing variable- arity functions,}
3030
3131@item{extending function definitions to include
3232@racket[case-lambda ]-style multiple-arity functions,}
@@ -68,7 +68,7 @@ that will cause the following program to signal an error:
6868
6969The function call knows how many arguments are given and the function
7070definition knows how many argument are expected. The generated code
71- should check that these two things match when the function is called.
71+ should check that these two quantities match when the function is called.
7272
7373A simple way to do this is to pick a designated register that will be
7474used for communicating arity information. The caller should set the
@@ -83,7 +83,7 @@ implement this part of the assignment.
8383@section[#:tag-prefix "a5- " #:style 'unnumbered #:tag "rest " ]{Rest
8484arguments}
8585
86- Many languages including JavaScript, C, and Racket include a facilty
86+ Many languages including JavaScript, C, and Racket provide facilities
8787for defining functions that take a ``rest argument'' which allows the
8888function to be called with more arguments than expected and these
8989additional arguments will be bound to a single value that collects all
@@ -138,15 +138,16 @@ pass all of the arguments on the stack along with information about
138138the number of arguments.
139139
140140The compilation of function definitions that use a rest argument
141- should generate code that check that the given number of arguments is
141+ should generate code that checks that the given number of arguments is
142142acceptable and should generate code to pop all ``extra'' arguments off
143143the stack and construct a list which is then bound to the rest
144144parameter.
145145
146- It is worth remembering that arguments are pushed on the stack in such a
147- way that the last argument is at the top of the stack. This has the
148- benefit of making it easy to pop off the extra arguments and to
149- construct a list with the elements in the proper order.
146+ It is worth remembering that arguments are pushed on the stack in such
147+ a way that the last argument is the element most recently pushed on
148+ the stack. This has the benefit of making it easy to pop off the
149+ extra arguments and to construct a list with the elements in the
150+ proper order.
150151
151152HINT: the function definition knows the number of ``required''
152153arguments, i.e. the minimum number of arguments the function can be
@@ -190,7 +191,7 @@ A @racket[case-lambda] form can have any number of clauses (including
190191zero!) and the first clause for which the number of arguments is
191192acceptable is taken when the function is called.
192193
193- Note that @racket[case-lambda ] can be combined with rest arguments so .
194+ Note that @racket[case-lambda ] can be combined with rest arguments too .
194195A clause that accepts any number of arguments is written by simply
195196listing a parameter name (no parentheses). A clause that accepts some
196197non-zero minimum number of parameters is written with a dotted
@@ -231,8 +232,8 @@ of arguments.
231232@section[#:tag-prefix "a5- " #:style 'unnumbered #:tag "apply " ]{Apply}
232233
233234Apply is the yin to the yang of rest arguments (or maybe the other way
234- around). Whereas a rest argument let 's a function take arbitrarily
235- more arguments and package them up as a list, @racket[apply] will
235+ around). Whereas a rest argument lets a function take arbitrarily
236+ more arguments and packages them up as a list, @racket[apply] will
236237apply a function to a list as though the elements of the list were
237238given as arguments.
238239
@@ -377,7 +378,7 @@ What used to be represented as @racket[(Defn _f _xs _e)] is now
377378represented as @racket[(Defn _f (FunPlain _xs _e))].
378379
379380
380- The parser already works for these new form of function definitions.
381+ The parser already works for these new forms of function definitions.
381382Here are some examples of how function definitions are parsed, but you
382383are encouraged to try out more to get a better sense:
383384
@@ -396,13 +397,13 @@ are encouraged to try out more to get a better sense:
396397
397398@section[#:tag-prefix "a5- " #:style 'unnumbered ]{Starter code}
398399
399- The code given to you is just an implementation of Iniquity, but
400- updated to parse the new forms of function definitions and
400+ The compiler code given to you is just an implementation of Iniquity,
401+ but updated to parse the new forms of function definitions and
401402re-organized slightly to match the new AST representation.
402403
403- The code also includes a full implementation of the interpreter, so
404- you do not need to update @racket[interp.rkt] and can use the
405- interpreter to guide your implementation of the compiler.
404+ The interpreter code given to you works on the full Iniquity+
405+ language, so you do not need to update @racket[interp.rkt] and can use
406+ the interpreter to guide your implementation of the compiler.
406407
407408@ex[
408409(interp
@@ -454,7 +455,7 @@ be pretty easy. Make sure it works for plain function definitions.}
454455@item{Move on to @secref[#:tag-prefixes '("a5- " ) "rest " ]. You could
455456start by emitting code that checks that the arguments are acceptable,
456457popping the appropriate number of arguments off (and ignoring the
457- elements), the pushing the empty list. This will work like a rest arg
458+ elements), then pushing the empty list. This will work like a rest arg
458459in that it should accept any number of arguments beyond the required
459460minimum, but the rest argument will always be bound to empty. Once
460461working, try to modify the code to build a list as it pops arguments.
@@ -489,15 +490,3 @@ such as when @racket[_e] is not a proper list.}
489490Submit a zip file containing your work to Gradescope. Use @tt{make
490491submit.zip} from within the @tt{iniquity-plus} directory to create a zip
491492file with the proper structure.
492-
493-
494-
495-
496-
497-
498-
499-
500-
501-
502-
503-
0 commit comments