|
|
@ -64,7 +64,7 @@
|
|
|
|
(define (display-yacc grammar tokens start precs port)
|
|
|
|
(define (display-yacc grammar tokens start precs port)
|
|
|
|
(let-syntax ((p (syntax-rules ()
|
|
|
|
(let-syntax ((p (syntax-rules ()
|
|
|
|
((_ args ...) (fprintf port args ...)))))
|
|
|
|
((_ args ...) (fprintf port args ...)))))
|
|
|
|
(let* ((tokens (map syntax-local-value (cdr (syntax->list tokens))))
|
|
|
|
(let* ((tokens (map syntax-local-value (syntax->list tokens)))
|
|
|
|
(eterms (filter e-terminals-def? tokens))
|
|
|
|
(eterms (filter e-terminals-def? tokens))
|
|
|
|
(terms (filter terminals-def? tokens))
|
|
|
|
(terms (filter terminals-def? tokens))
|
|
|
|
(term-table (make-hash-table))
|
|
|
|
(term-table (make-hash-table))
|
|
|
@ -97,7 +97,7 @@
|
|
|
|
(p " ~a" (hash-table-get term-table tok)))
|
|
|
|
(p " ~a" (hash-table-get term-table tok)))
|
|
|
|
(cdr prec))
|
|
|
|
(cdr prec))
|
|
|
|
(p "~n"))
|
|
|
|
(p "~n"))
|
|
|
|
(cdr precs)))
|
|
|
|
precs))
|
|
|
|
(p "%start ~a~n" start)
|
|
|
|
(p "%start ~a~n" start)
|
|
|
|
(p "%%~n")
|
|
|
|
(p "%%~n")
|
|
|
|
|
|
|
|
|
|
|
@ -110,7 +110,7 @@
|
|
|
|
(display-rhs rhs))
|
|
|
|
(display-rhs rhs))
|
|
|
|
(cddr prod))
|
|
|
|
(cddr prod))
|
|
|
|
(p ";~n")))
|
|
|
|
(p ";~n")))
|
|
|
|
(cdr grammar))
|
|
|
|
grammar)
|
|
|
|
(p "%%~n"))))
|
|
|
|
(p "%%~n"))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|