Skip to content

Commit a3eb795

Browse files
authored
Merge pull request #99 from cmsc430/next
Next
2 parents 5b8301c + caa46b9 commit a3eb795

93 files changed

Lines changed: 6455 additions & 1661 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

langs/a86/ast.rkt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@
131131
(instruct Je (x) check:target)
132132
(instruct Jne (x) check:target)
133133
(instruct Jl (x) check:target)
134+
(instruct Jle (x) check:target)
134135
(instruct Jg (x) check:target)
136+
(instruct Jge (x) check:target)
135137
(instruct And (dst src) check:src-dest)
136138
(instruct Or (dst src) check:src-dest)
137139
(instruct Xor (dst src) check:src-dest)
@@ -191,7 +193,9 @@
191193
(Je? x)
192194
(Jne? x)
193195
(Jl? x)
196+
(Jle? x)
194197
(Jg? x)
198+
(Jge? x)
195199
(And? x)
196200
(Or? x)
197201
(Xor? x)
@@ -271,8 +275,12 @@
271275
(cons s (label-uses asm))]
272276
[(cons (Jg (? label-symbol? s)) asm)
273277
(cons s (label-uses asm))]
278+
[(cons (Jge (? label-symbol? s)) asm)
279+
(cons s (label-uses asm))]
274280
[(cons (Jl (? label-symbol? s)) asm)
275281
(cons s (label-uses asm))]
282+
[(cons (Jle (? label-symbol? s)) asm)
283+
(cons s (label-uses asm))]
276284
[(cons (Call (? label-symbol? s)) asm)
277285
(cons s (label-uses asm))]
278286
[(cons (Lea _ (? label-symbol? s)) asm)

langs/a86/printer.rkt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
[(Offset (? reg? r) i)
5555
(string-append "[" (reg->string r) " + " (number->string i) "]")]
5656
[(Offset (? label? l) i)
57-
(string-append "[" (symbol->string l) " + " (number->string i) "]")]
57+
(string-append "[" (label-symbol->string l) " + " (number->string i) "]")]
5858
[(Const l)
5959
(symbol->string l)]
6060
[(? exp?) (exp->string a)]))
@@ -127,9 +127,15 @@
127127
[(Jl l)
128128
(string-append tab "jl "
129129
(jump-target->string l))]
130+
[(Jle l)
131+
(string-append tab "jle "
132+
(jump-target->string l))]
130133
[(Jg l)
131134
(string-append tab "jg "
132135
(jump-target->string l))]
136+
[(Jge l)
137+
(string-append tab "jge "
138+
(jump-target->string l))]
133139
[(Call l)
134140
(string-append tab "call "
135141
(jump-target->string l))]

langs/evildoer/interp-file.rkt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
(let ((p (open-input-file fn)))
1010
(begin
1111
(read-line p) ; ignore #lang racket line
12-
(println (interp (parse (read p))))
12+
(let ((r (interp (parse (read p)))))
13+
(unless (void? r)
14+
(println r)))
1315
(close-input-port p))))

langs/fraud/interp-file.rkt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
(let ((p (open-input-file fn)))
1010
(begin
1111
(read-line p) ; ignore #lang racket line
12-
(println (interp (parse (read p))))
12+
(let ((r (interp (parse (read p)))))
13+
(unless (void? r)
14+
(println r)))
1315
(close-input-port p))))

langs/hoax/ast.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
;; | 'vector? | vector-length
2626
;; | 'string? | string-length
2727
;; type Op2 = '+ | '- | '< | '=
28-
;; | 'cons
28+
;; | 'cons | 'eq?
2929
;; | 'make-vector | 'vector-ref
3030
;; | 'make-string | 'string-ref
3131
;; type Op3 = 'vector-set!

langs/hoax/compile-ops.rkt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@
216216

217217
(Sar rax char-shift)
218218

219-
(Add r9 1) ; adds 1
220-
(Sar r9 1) ; when
221-
(Sal r9 1) ; len is odd
219+
(Add r8 1) ; adds 1
220+
(Sar r8 1) ; when
221+
(Sal r8 1) ; len is odd
222222

223223
(Label loop)
224224
(Mov (Offset rbx 0) eax)

langs/hoax/interp-file.rkt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
(let ((p (open-input-file fn)))
1010
(begin
1111
(read-line p) ; ignore #lang racket line
12-
(println (interp (parse (read p))))
12+
(let ((r (interp (parse (read p)))))
13+
(unless (void? r)
14+
(println r)))
1315
(close-input-port p))))

langs/hoax/interp.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
[(Eof) eof]
3434
[(Empty) '()]
3535
[(Var x) (lookup r x)]
36-
[(Str s) (string-copy s)]
36+
[(Str s) s]
3737
[(Prim0 'void) (void)]
3838
[(Prim0 'read-byte) (read-byte)]
3939
[(Prim0 'peek-byte) (peek-byte)]

langs/hoax/test/test-runner.rkt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@
149149
(check-equal? (run '(string-ref "fred" 2)) #\e)
150150
(check-equal? (run '(string-ref "fred" 4)) 'err)
151151
(check-equal? (run '(string? "fred")) #t)
152-
(check-equal? (run '(string? (cons 1 2))) #f))
152+
(check-equal? (run '(string? (cons 1 2))) #f)
153+
(check-equal? (run '(begin (make-string 3 #\f)
154+
(make-string 3 #\f)))
155+
"fff"))
153156

154157
(define (test-runner-io run)
155158
;; Evildoer examples

langs/hustle/interp-file.rkt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
(let ((p (open-input-file fn)))
1010
(begin
1111
(read-line p) ; ignore #lang racket line
12-
(println (interp (parse (read p))))
12+
(let ((r (interp (parse (read p)))))
13+
(unless (void? r)
14+
(println r)))
1315
(close-input-port p))))

0 commit comments

Comments
 (0)