[R6RS] How to make -> a valid identifier [was: 3 things we may want to vote on]

Manuel Serrano Manuel.Serrano
Wed Jun 8 03:52:14 EDT 2005


> That's definitely the issue.  I'd be interested how the readers in the
> various Scheme implementations work.  The relevant part in the Scheme
Bigloo's reader relies on lexical grammars. The grammar for identifiers
is:

   (regular-grammar ((float    (or (: (* digit) "." (+ digit))
				   (: (+ digit) "." (* digit))))
		     (letter   (in ("azAZ") (#a128 #a255)))
		     (special  (in "!@~$%^&*></-_+\\=?.:"))
		     (kspecial (in "!@~$%^&*></-_+\\=?."))
		     (quote    (in "\",'`"))
		     (paren    (in "()[]{}"))
		     (id       (: (* digit)
				  (or letter special)
				  (* (or letter special digit (in ",'`")))))
		     (kid      (: (* digit)
				  (or letter kspecial)
				  (* (or letter kspecial digit (in ",'`")))))
		     (blank    (in #\Space #\Tab #a012 #a013)))
     ...

      ;; identifiers
      (id
       ;; this rule has to be placed after the rule matching the `.' char
       (the-symbol))
      ((: "|" (* (or (out #a000 #\\ #\|) (: #\\ all))) "|")
       (if (=fx (the-length) 2)
	   (string->symbol "")
	   (let ((str (the-substring 0 (-fx (the-length) 1))))
	      (string->symbol (escape-C-string str)))))
     ...
     )      

		     
		     
      



-- 
Manuel


More information about the R6RS mailing list