Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions a86/interp.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -215,30 +215,9 @@
"if you did and still get this error; please share with course staff."))

(define (clang:error msg)
(raise (exn:clang (format "~a\n\n~a~a" assembly-error-msg msg (assembly-offending-line msg))
(raise (exn:clang (format "~a\n\n~a" assembly-error-msg msg)
(current-continuation-marks))))

(define (assembly-offending-line msg)
(match (regexp-match
"(.*):([0-9]+):([0-9]+): error: " msg)
[(list _ (app string->path file) (app string->number line) (app string->number offset))
(define line-text
(with-input-from-file file
(thunk
(let loop ([l (read-line)]
[i line])
(if (= i 1)
l
(loop (read-line) (sub1 i)))))))
(match (regexp-match "[ ]*(.*)" line-text)
[(list _ trimmed-line)
(format
"\noffending line: ~a\n ~a^"
trimmed-line
(make-string offset #\space))])]
[_ ""]))


;; run clang on t.s to create t.o
(define (clang t.s t.o)
(define err-port (open-output-string))
Expand Down