Run Resyntax again

remotes/jackfirth/master
Jack Firth 3 years ago
parent 14949f8241
commit c339773860

@ -27,7 +27,7 @@
(define orig-insp (variable-reference->module-declaration-inspector
(#%variable-reference)))
(define (disarm stx)
(syntax-disarm stx orig-insp))
stx)
;; parse : syntax-object (box (list-of syntax-object)) -> s-re (see re.rkt)
;; checks for errors and generates the plain s-exp form for s
@ -37,10 +37,10 @@
;; seen-lex-abbrevs: id-table
[seen-lex-abbrevs (make-immutable-free-id-table)])
(define (recur s)
(loop (syntax-rearm s stx)
(loop s
seen-lex-abbrevs))
(define (recur/abbrev s id)
(loop (syntax-rearm s stx)
(loop s
(free-id-table-set seen-lex-abbrevs id id)))
(syntax-case (disarm stx) (repetition union intersection complement concatenation
char-range char-complement)

@ -42,7 +42,7 @@
(let loop ([p (pop)])
(set-N p +inf.0)
(hash-set! results p (f x))
(when (not (eq? x p))
(unless (eq? x p)
(loop (pop))))))
;; Will map elements of 'a to 'b sets
(for ([x (in-list nodes)]

@ -143,7 +143,7 @@
(λ (state)
(for ([non-term (in-list (grammar-non-terms g))])
(define res (f (trans-key state non-term)))
(when (not (null? res))
(unless (null? res)
(printf "~a(~a, ~a) = ~a\n"
name
state
@ -155,15 +155,15 @@
(printf "~a:\n" name)
(send a for-each-state
(λ (state)
(for ([non-term (in-list (grammar-non-terms g))])
(for ([prod (in-list (grammar-prods-for-non-term g non-term))])
(for* ([non-term (in-list (grammar-non-terms g))]
[prod (in-list (grammar-prods-for-non-term g non-term))])
(define res (f state prod))
(when (not (null? res))
(unless (null? res)
(printf "~a(~a, ~a) = ~a\n"
name
(kernel-index state)
(prod-index prod)
(print-output res))))))))
(print-output res)))))))
(define (print-output-terms r)
(map gram-sym-symbol r))

Loading…
Cancel
Save