[plt-scheme] New Match Implementation
Hi Sam,
On Thu, Mar 27, 2008 at 04:27:08PM +1100, Andrew Reilly wrote:
> On Wed, Mar 26, 2008 at 10:54:57AM -0400, Sam TH wrote:
> > I've just changed the implementation of the various pattern matching
> > libraries in PLT (scheme/match, mzlib/plt-match, mzlib/match) to a
> > new, from-scratch implementation. This new implementation should have
> > significantly faster compile times, especially with complicated match
> > expressions.
>
> Might this have left the builds in a state of flux? (See my
> comments about 3.99.0.20 from yesterday and just now...) I'll
> try downloading the latest version (which will have this change
> in it, right?) and see if my test case still provokes weirdness.
OK, I've just downloaded 3.99.0.21, and it produces the same
debug-like output that I reported earlier.
If foo.ss contains:
#lang scheme
(define (data-set d)
(map
(match-lambda
((list 'param (list-no-order (list 'row row) (list 'col col) (list 'value value) _ ...))
(list row col value))
((list 'path (list-no-order (list 'relative rel) _ ...) path)
(list rel path))
((list 'string (list-no-order (list 'id id) _ ...) s)
(list id s)))
d))
then "mzscheme foo.ss" produces the attached output
(foo_out.txt), and it really shouldn't produce anything, I think
(since there aren't any top-level statements beyond the define).
Thoughts?
Cheers,
--
Andrew
-------------- next part --------------
(list (quote row) (var row)) (lambda (exp) (if (and (pair? exp) (equal? (car exp) (quote row))) (let ((exp56 (cdr exp))) (if (and (pair? exp56) (null? (cdr exp56))) (begin (set! row45 (car exp56)) #t) #f)) #f)) ((#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 291 49 12901 926)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 272 25 11774 2514)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (gen-match . #f) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/match-internal-func.ss> 15 2 335 192)))
(list (quote col) (var col)) (lambda (exp) (if (and (pair? exp) (equal? (car exp) (quote col))) (let ((exp57 (cdr exp))) (if (and (pair? exp57) (null? (cdr exp57))) (begin (set! col44 (car exp57)) #t) #f)) #f)) ((#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 291 49 12901 926)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 272 25 11774 2514)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (gen-match . #f) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/match-internal-func.ss> 15 2 335 192)))
(list (quote value) (var value)) (lambda (exp) (if (and (pair? exp) (equal? (car exp) (quote value))) (let ((exp58 (cdr exp))) (if (and (pair? exp58) (null? (cdr exp58))) (begin (set! value43 (car exp58)) #t) #f)) #f)) ((#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 291 49 12901 926)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 272 25 11774 2514)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (gen-match . #f) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/match-internal-func.ss> 15 2 335 192)))
(list (quote relative) (var rel)) (lambda (exp) (if (and (pair? exp) (equal? (car exp) (quote relative))) (let ((exp60 (cdr exp))) (if (and (pair? exp60) (null? (cdr exp60))) (begin (set! rel49 (car exp60)) #t) #f)) #f)) ((#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 291 49 12901 926)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 272 25 11774 2514)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (gen-match . #f) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/match-internal-func.ss> 15 2 335 192)))
(list (quote id) (var id)) (lambda (exp) (if (and (pair? exp) (equal? (car exp) (quote id))) (let ((exp61 (cdr exp))) (if (and (pair? exp61) (null? (cdr exp61))) (begin (set! id53 (car exp61)) #t) #f)) #f)) ((#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 291 49 12901 926)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/render-test-list-impl.ss> 272 25 11774 2514)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/coupling-and-binding.scm> 81 18 3918 194)) (emit . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/emit-assm.scm> 31 2 1097 849)) (gen-match . #f) (#f . #(struct:srcloc #<path:/Applications/PLT Scheme v3.99.0.21/collects/mzlib/private/match/match-internal-func.ss> 15 2 335 192)))