*** empty log message ***

original commit: 36bccc62d0555fc59aa6fddfe90b15012dd66c8f
tokens
Scott Owens 23 years ago
parent 00bae08fd7
commit 024d9d45cf

@ -10,7 +10,7 @@
(provide lex define-lex-abbrev define-lex-abbrevs
make-lex-buf
get-position position-offset position-line position-col position?
define-tokens define-empty-tokens)
define-tokens define-empty-tokens token-value token-name token?)
(define-syntax lex

@ -12,19 +12,36 @@
(let* ((grammar (parse-input start end input-terms assocs prods runtime))
(table (build-table grammar filename))
(table-code
(cons 'vector
(map (lambda (action)
`((lambda (table-list)
(let ((v (list->vector table-list)))
(let loop ((i 0))
(cond
((< i (vector-length v))
(let ((vi (vector-ref v i)))
(cond
((list? vi)
(vector-set! v i
(cond
((eq? 's (car vi))
(make-shift (cadr vi)))
((eq? 'r (car vi))
(make-reduce (cadr vi) (caddr vi) (cadddr vi)))
((eq? 'a (car vi)) (make-accept)))))))
(loop (add1 i)))
(else v)))))
(quote
,(map (lambda (action)
(cond
((shift? action)
`(make-shift ,(shift-state action)))
`(s ,(shift-state action)))
((reduce? action)
`(make-reduce ,(reduce-prod-num action)
`(r ,(reduce-prod-num action)
,(reduce-lhs-num action)
,(reduce-rhs-length action)))
((accept? action)
`(make-accept))
`(a))
(else action)))
(vector->list table))))
(vector->list table)))))
(num-non-terms (length (grammar-non-terms grammar)))

Loading…
Cancel
Save