* Modified the reader and writer to accept "->[subsequent]*" as an

identifier.
This commit is contained in:
Abdulaziz Ghuloum 2007-01-26 09:05:07 -05:00
parent d8f646040f
commit 8139a91a61
5 changed files with 25 additions and 7 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
#!eof
;;; input to cogen is <Program>: ;;; input to cogen is <Program>:
;;; <Expr> ::= (constant x) ;;; <Expr> ::= (constant x)
;;; | (var) ;;; | (var)

View File

@ -5101,7 +5101,7 @@
[p (convert-closures p)] [p (convert-closures p)]
[p (optimize-closures/lift-codes p)] [p (optimize-closures/lift-codes p)]
[p^ (new-cogen p)] ;[p^ (new-cogen p)]
[p (introduce-primcalls p)] [p (introduce-primcalls p)]
[p (simplify-operands p)] [p (simplify-operands p)]
[p (insert-stack-overflow-checks p)] [p (insert-stack-overflow-checks p)]

View File

@ -190,6 +190,11 @@
[($char= c #\.) [($char= c #\.)
(read-char p) (read-char p)
(cons 'datum (tokenize-flonum/no-digits #f p))] (cons 'datum (tokenize-flonum/no-digits #f p))]
[($char= c #\>)
(read-char p)
(let ([ls (tokenize-identifier '() p)])
(let ([str (list->string (list* #\- #\> (reverse ls)))])
(cons 'datum (string->symbol str))))]
[else (error 'tokenize "invalid sequence -~a" c)])))) [else (error 'tokenize "invalid sequence -~a" c)]))))
(define tokenize-dot (define tokenize-dot
(lambda (p) (lambda (p)

View File

@ -105,13 +105,26 @@
(subsequent*? str ($fxadd1 i) n))))) (subsequent*? str ($fxadd1 i) n)))))
(define valid-symbol-string? (define valid-symbol-string?
(lambda (str) (lambda (str)
(or (let ([n ($string-length str)]) (define normal-symbol-string?
(lambda (str)
(let ([n ($string-length str)])
(and ($fx>= n 1) (and ($fx>= n 1)
(initial? ($string-ref str 0)) (initial? ($string-ref str 0))
(subsequent*? str 1 n))) (subsequent*? str 1 n)))))
(string=? str "+") (define peculiar-symbol-string?
(string=? str "-") (lambda (str)
(string=? str "...")))) (let ([n (string-length str)])
(cond
[(fx= n 1)
(memq (string-ref str 0) '(#\+ #\-))]
[(fx>= n 2)
(or (and (char=? (string-ref str 0) #\-)
(char=? (string-ref str 1) #\>)
(subsequent*? str 2 n))
(string=? str "..."))]))))
(or (normal-symbol-string? str)
(peculiar-symbol-string? str))))
(define write-symbol-esc-loop (define write-symbol-esc-loop
(lambda (x i n p) (lambda (x i n p)
(unless ($fx= i n) (unless ($fx= i n)