gecko-dev/js2/semantics/Test/TestToRational.lisp
waldemar%netscape.com 477b09de7f First version
2002-09-25 23:48:38 +00:00

17 lines
546 B
Common Lisp

(progn
(defparameter *trw*
(generate-world
"TTR"
'((grammar test-to-rational-grammar :lalr-1 :start)
(production :start () start-none)
(define (to-rational (x finite-general-number)) rational
(case x
(:select (tag +zero32 +zero64 -zero32 -zero64) (return 0))
(:narrow (union nonzero-finite-float32 nonzero-finite-float64 long u-long) (return (& value x))))))))
(defparameter *trg* (world-grammar *trw* 'test-to-rational-grammar)))
(length (grammar-states *trg*))