Skip to content

Commit 69abf46

Browse files
committed
Merge branch 'main' of github.com:cmsc430/www
2 parents 0f41fb0 + a46afa7 commit 69abf46

7 files changed

Lines changed: 24 additions & 44 deletions

File tree

langs/fraud/compile.rkt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
;; Registers used
66
(define rax 'rax) ; return
7-
(define rbx 'rbx) ; heap
87
(define rsp 'rsp) ; stack
98
(define rdi 'rdi) ; arg
109

11-
;; type CEnv = [Listof Variable]
10+
;; type CEnv = (Listof ID)
1211

1312
;; Expr -> Asm
1413
(define (compile e)

langs/fraud/interp-lexical.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
(define (interp e)
99
(interp-env (translate e) '()))
1010

11-
;; Expr VEnv -> Answer
11+
;; IExpr VEnv -> Answer
1212
(define (interp-env e r)
1313
(match e
1414
[(Int i) i]

langs/fraud/interp.rkt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
;; | Eof
1212
;; | Void
1313

14-
;; type REnv = (Listof (List Id Value))
14+
;; type Env = (Listof (List Id Value))
1515

1616
;; Expr -> Answer
1717
(define (interp e)
@@ -23,9 +23,9 @@
2323
[(Int i) i]
2424
[(Bool b) b]
2525
[(Char c) c]
26-
[(Eof) eof]
26+
[(Eof) eof]
2727
[(Var x) (lookup r x)]
28-
[(Prim0 p) (interp-prim0 p)]
28+
[(Prim0 p) (interp-prim0 p)]
2929
[(Prim1 p e)
3030
(match (interp-env e r)
3131
['err 'err]
@@ -61,6 +61,6 @@
6161
(lookup r x))]))
6262

6363
;; Env Id Value -> Env
64-
(define (ext r v val)
65-
(cons (list v val) r))
64+
(define (ext r x v)
65+
(cons (list x v) r))
6666

langs/hustle/interp-heap.rkt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#lang racket
22
(provide interp interp-env-heap)
3-
(require "heap.rkt"
4-
"env.rkt"
3+
(require "env.rkt"
54
"unload.rkt"
65
"interp-prims-heap.rkt"
76
"ast.rkt")

langs/hustle/interp-prims-heap.rkt

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#lang racket
2-
(provide interp-prim1 interp-prim2 interp-prim3)
2+
(provide interp-prim1 interp-prim2)
33
(require "heap.rkt")
44

55
;; Op1 Value* Heap -> Answer*
@@ -18,9 +18,6 @@
1818
[(list 'car (list 'cons i)) (cons h (heap-ref h i))]
1919
[(list 'cdr (list 'cons i)) (cons h (heap-ref h (add1 i)))]
2020
[(list 'empty? v) (cons h (empty? v))]
21-
[(list 'string? (list 'str s)) (cons h #t)]
22-
[(list 'string? v) (cons h #f)]
23-
[(list 'string-length (list 'str a)) (cons h (heap-ref h a))]
2421
[_ 'err]))
2522

2623
;; Op2 Value* Value* Heap -> Answer*
@@ -35,24 +32,8 @@
3532
[(list (list t1 a1) (list t2 a2)) (cons h (and (eq? t1 t2) (= a1 a2)))]
3633
[_ (cons h (eqv? v1 v2))])]
3734
[(list 'cons v1 v2) (alloc-cons v1 v2 h)]
38-
[(list 'make-string (? integer? i) (? char? c))
39-
(if (<= 0 i)
40-
(alloc-str (make-string i c) h)
41-
'err)]
42-
[(list 'string-ref (list 'str a) (? integer? i))
43-
(cons h (heap-ref h (+ a i 1)))]
4435
[_ 'err]))
4536

46-
;; Op2 Value* Value* Heap -> Answer*
47-
(define (interp-prim3 p v1 v2 v3 h)
48-
(match (list p v1 v2 v3)
49-
[(list 'string-set! (list 'str a) (? integer? i) (? char? c))
50-
(if (<= 0 v2 (sub1 (heap-ref h a)))
51-
(cons (heap-set h (+ a i 1) c)
52-
(void))
53-
'err)]
54-
[_ 'err]))
55-
5637
;; Any -> Boolean
5738
(define (codepoint? v)
5839
(and (integer? v)

www/assignments.scrbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@include-section{assignments/1.scrbl}
77
@include-section{assignments/2.scrbl}
88
@include-section{assignments/3.scrbl}
9-
@;include-section{assignments/4.scrbl}
9+
@include-section{assignments/4.scrbl}
1010
@;include-section{assignments/5.scrbl}
1111
@;include-section{assignments/6.scrbl}
1212
@;;include-section{assignments/7.scrbl}

www/assignments/4.scrbl

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77

88
@(require "../notes/ev.rkt")
99

10-
@bold{Due: Thursday, Mar 31st at 11:59PM EST}
10+
@bold{Due: Tuesday, Oct 18, 11:59PM EST}
1111

1212
The goal of this assignment is to extend a compiler with binding
1313
forms and primitives that can take any number of arguments.
1414

15-
You are given a zip file on ELMS with a starter compiler similar to
16-
the @seclink["Fraud"]{Fraud} language we studied in class. You are
17-
tasked with:
15+
You are given a @tt{fraud-plus.zip} file on ELMS with a starter
16+
compiler similar to the @seclink["Fraud"]{Fraud} language we studied
17+
in class. You are tasked with:
1818

1919
@itemlist[
2020

2121
@item{incorporating the language features you added in
22-
@seclink["Assignment 3"]{Assignment 3},}
22+
@seclink["Assignment 3"]{Assignment 3}, scaled up to Fraud,}
2323

2424
@item{extending the addition primitive to handle an arbitrary number of arguments,}
2525

@@ -182,12 +182,13 @@ write additional test cases.
182182

183183
@section[#:tag-prefix "a4-" #:style 'unnumbered]{Submitting}
184184

185-
You should submit on Gradescope. You should submit a zip file that has
186-
exactly the same structure that the stub contains. We will only use
187-
the @tt{compile.rkt}, @tt{interp.rkt}, and @tt{interp-prim.rkt} files
188-
for grading, so make sure all your work is contained there! Note the
189-
lack of @tt{ast.rkt}, @tt{parse.rkt}, etc. - part of assignment 3 was
190-
learning to design your own structures, part of assignment 4 is
191-
learning to work within the constraints of an existing design!
192-
185+
Submit a zip file containing your work to Gradescope. Use @tt{make
186+
submit.zip} from within the @tt{dupe-plus} directory to create a zip
187+
file with the proper structure.
193188

189+
We will only use the @tt{compile.rkt}, @tt{interp.rkt}, and
190+
@tt{interp-prim.rkt} files for grading, so make sure all your work is
191+
contained there! Note the lack of @tt{ast.rkt}, @tt{parse.rkt}, etc. -
192+
part of assignment 3 was learning to design your own structures, part
193+
of assignment 4 is learning to work within the constraints of an
194+
existing design!

0 commit comments

Comments
 (0)