{quick,merge}sort -> sort

svn: r2569

original commit: 16f01a1109691d2fa4844b9411410f4794cf0dc1
tokens
Eli Barzilay 19 years ago
parent 97678a2e96
commit 5112a6a054

@ -239,19 +239,19 @@
(cond
((and (null? old-states) (null? new-states))
(make-dfa (get-state-number) (state-index start)
(mergesort (filter (lambda (x) (cdr x))
(map (lambda (state)
(cons (state-index state) (get-final (state-spec state))))
all-states))
(lambda (a b) (< (car a) (car b))))
(mergesort (hash-table-map transitions
(lambda (state trans)
(cons (state-index state)
(map (lambda (t)
(cons (car t)
(state-index (cdr t))))
trans))))
(lambda (a b) (< (car a) (car b))))))
(sort (filter (lambda (x) (cdr x))
(map (lambda (state)
(cons (state-index state) (get-final (state-spec state))))
all-states))
(lambda (a b) (< (car a) (car b))))
(sort (hash-table-map transitions
(lambda (state trans)
(cons (state-index state)
(map (lambda (t)
(cons (car t)
(state-index (cdr t))))
trans))))
(lambda (a b) (< (car a) (car b))))))
((null? old-states)
(loop new-states null all-states (compute-chars new-states)))
((null? cs)

@ -31,7 +31,7 @@
(let* ((from-state (car trans))
(all-chars/to (cdr trans))
(flat-all-chars/to
(mergesort
(sort
(apply append
(map (lambda (chars/to)
(let ((char-ranges (loc:integer-set-contents (car chars/to)))

@ -85,7 +85,7 @@
;; Sorts l according to index and removes the entries with duplicate
;; indexes.
(define (do-simple-equiv l index)
(let ((ordered (mergesort l (lambda (a b) (< (index a) (index b))))))
(let ((ordered (sort l (lambda (a b) (< (index a) (index b))))))
(remove-dups ordered index null)))
(test-block ()

@ -28,7 +28,7 @@
(non-term-index (trans-key-gs b)))))))
(define (trans-key-list-remove-dups tkl)
(let loop ((sorted (quicksort tkl trans-key<?)))
(let loop ((sorted (sort tkl trans-key<?)))
(cond
((null? sorted) null)
((null? (cdr sorted)) sorted)
@ -41,7 +41,6 @@
(cons (car sorted) (loop (cdr sorted))))))))
;; build-transition-table : int (listof (cons/c trans-key X) ->
;; (vectorof (symbol X hashtable))
(define (build-transition-table num-states assoc)
@ -279,7 +278,7 @@
(let* ((gs (car i))
(items (cadr i))
(new #f)
(new-kernel (quicksort
(new-kernel (sort
(filter (lambda (x) x)
(map move-dot-right items))
item<?))

@ -124,8 +124,8 @@
(let ((t (get-token-grammar i)))
t)))))
`(begin
(define-tokens t ,(quicksort (hash-table-map terms (lambda (k v) k)) symbol<?))
(define-empty-tokens et ,(quicksort (hash-table-map eterms (lambda (k v) k)) symbol<?))
(define-tokens t ,(sort (hash-table-map terms (lambda (k v) k)) symbol<?))
(define-empty-tokens et ,(sort (hash-table-map eterms (lambda (k v) k)) symbol<?))
(parser
(start ___)
(end ___)

Loading…
Cancel
Save