Browse files

Add Zach's crazy try-to-correlate-error idea.

  • Loading branch information...
pavpanchekha committed Feb 18, 2014
1 parent 87712bd commit cd478561b0fabef33ea5b223bbe6dad7a90fd809
Showing with 23 additions and 0 deletions.
  1. +23 −0 casio/analyze-subexpressions.rkt
@@ -118,3 +118,26 @@
(loop (argmin (curryr alt-error-at (car input)) alts)
(- left 1))))])))
(define (strip-off-top loc)
(let ([loc* (reverse loc)])
(match loc*
[`(car cdr car . ,rest)
(values (reverse (cons 'car rest))
(reverse (list* 'car 'cdr 'cdr 'car rest)))]
[`(car cdr cdr car . ,rest)
(values (reverse (cons 'car rest))
(reverse (list* 'car 'cdr 'car rest)))]
(error "Wat?")])))
(define (correlate-binary-ops alt0)
(define input (pick-bad-input alt0))
(let* ([annot (analyze-expressions (alt-program alt0) (caddr input))]
[loc (find-most-local-error annot)])
(if loc
(let-values ([(parent other) (strip-off-top loc)])
(if (= (length (location-get parent (alt-program alt0))) 3)
(alt-rewrite-tree alt0 #:root other)

0 comments on commit cd47856

Please sign in to comment.