| 1 |
;;; Ikarus Scheme -- A compiler for R6RS Scheme. |
| 2 |
;;; Copyright (C) 2008,2009 Abdulaziz Ghuloum |
| 3 |
;;; |
| 4 |
;;; This program is free software: you can redistribute it and/or modify |
| 5 |
;;; it under the terms of the GNU General Public License version 3 as |
| 6 |
;;; published by the Free Software Foundation. |
| 7 |
;;; |
| 8 |
;;; This program is distributed in the hope that it will be useful, but |
| 9 |
;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
;;; General Public License for more details. |
| 12 |
;;; |
| 13 |
;;; You should have received a copy of the GNU General Public License |
| 14 |
;;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
(library (ikarus.string-to-number) |
| 19 |
(export string->number define-string->number-parser) |
| 20 |
(import (except (ikarus) string->number)) |
| 21 |
|
| 22 |
(define who 'string->number) |
| 23 |
(define (do-sn/ex sn ex ac) |
| 24 |
(* sn (if (eq? ex 'i) (inexact ac) ac))) |
| 25 |
(define (do-dec-sn/ex sn ex ac) |
| 26 |
(* sn (if (eq? ex 'e) ac (inexact ac)))) |
| 27 |
(define (sign c) |
| 28 |
(case c |
| 29 |
[(#\+) +1] |
| 30 |
[(#\-) -1] |
| 31 |
[else #f])) |
| 32 |
(define (digit c r) |
| 33 |
(let ([n (fx- (char->integer c) (char->integer #\0))]) |
| 34 |
(cond |
| 35 |
[(and (fx>=? n 0) (fx< n r)) n] |
| 36 |
[(eqv? r 16) |
| 37 |
(let ([n (fx- (char->integer c) (char->integer #\a))]) |
| 38 |
(cond |
| 39 |
[(and (fx>=? n 0) (fx< n 6)) (+ n 10)] |
| 40 |
[else |
| 41 |
(let ([n (fx- (char->integer c) (char->integer #\A))]) |
| 42 |
(cond |
| 43 |
[(and (fx>=? n 0) (fx< n 6)) (+ n 10)] |
| 44 |
[else #f]))]))] |
| 45 |
[else #f]))) |
| 46 |
|
| 47 |
(module (define-parser) |
| 48 |
(define-syntax gen-empty |
| 49 |
(syntax-rules (eof) |
| 50 |
[(_ C Ca) (C EOF-ERROR Ca)] |
| 51 |
[(_ C Ca [(eof) then] . rest) then] |
| 52 |
[(_ C Ca other . rest) (gen-empty C Ca . rest)])) |
| 53 |
(define-syntax gen-delimiter |
| 54 |
(syntax-rules (eof) |
| 55 |
[(_ C Ca c) |
| 56 |
(C GEN-DELIM-TEST c |
| 57 |
(C FAIL Ca) |
| 58 |
(C FAIL Ca c))] |
| 59 |
[(_ C Ca c [(eof) then] . rest) |
| 60 |
(C GEN-DELIM-TEST c |
| 61 |
then |
| 62 |
(C FAIL Ca c))] |
| 63 |
[(_ C Ca c other . rest) (gen-delimiter C Ca c . rest)])) |
| 64 |
(define-syntax gen-char |
| 65 |
(syntax-rules (eof =>) |
| 66 |
[(_ C Ca c dc) dc] |
| 67 |
[(_ C Ca c dc [(eof) then] . rest) |
| 68 |
(gen-char C Ca c dc . rest)] |
| 69 |
[(_ C Ca c dc [(test . args) => result then] . rest) |
| 70 |
(cond |
| 71 |
[(test c . args) => |
| 72 |
(lambda (result) then)] |
| 73 |
[else (gen-char C Ca c dc . rest)])] |
| 74 |
[(_ C Ca c dc [ls then] . rest) |
| 75 |
(if (memv c 'ls) |
| 76 |
then |
| 77 |
(gen-char C Ca c dc . rest))])) |
| 78 |
(define-syntax gen-clause |
| 79 |
(syntax-rules () |
| 80 |
[(_ (Ca ...) C next fail name (arg* ...) (clause* ...)) |
| 81 |
(define (name Ca ... arg* ...) |
| 82 |
(C GEN-TEST c next fail (Ca ...) |
| 83 |
(gen-empty C (Ca ...) clause* ...) |
| 84 |
(gen-char C (Ca ...) c |
| 85 |
(gen-delimiter C (Ca ...) c clause* ...) |
| 86 |
clause* ...)))])) |
| 87 |
(define-syntax define-parser^ |
| 88 |
(lambda (x) |
| 89 |
(define (lookup ls1 ls2) |
| 90 |
(lambda (var) |
| 91 |
(let f ([ls1 ls1] [ls2 ls2]) |
| 92 |
(cond |
| 93 |
[(null? ls1) |
| 94 |
(error 'define-parser "cannot find" var)] |
| 95 |
[(bound-identifier=? var (car ls1)) |
| 96 |
(car ls2)] |
| 97 |
[else (f (cdr ls1) (cdr ls2))])))) |
| 98 |
(syntax-case x () |
| 99 |
[(_ (entries ...) config next fail |
| 100 |
orig* |
| 101 |
[name* (arg** ...) clause** ...] ...) |
| 102 |
(with-syntax ([(mapped-entries ...) |
| 103 |
(map |
| 104 |
(lookup |
| 105 |
(syntax->datum #'orig*) |
| 106 |
#'(name* ...)) |
| 107 |
#'(entries ...))]) |
| 108 |
#'(begin |
| 109 |
(config GEN-ARGS |
| 110 |
gen-clause config next fail name* |
| 111 |
(arg** ...) |
| 112 |
(clause** ...)) |
| 113 |
... |
| 114 |
(define entries mapped-entries) |
| 115 |
...))]))) |
| 116 |
(define-syntax define-parser |
| 117 |
(lambda (x) |
| 118 |
(syntax-case x () |
| 119 |
[(_ definer next fail [name* (arg** ...) clause** ...] ...) |
| 120 |
(with-syntax ([orig* (datum->syntax #'foo #'(name* ...))]) |
| 121 |
#'(define-syntax definer |
| 122 |
(syntax-rules () |
| 123 |
[(_ config (entries (... ...))) |
| 124 |
(define-parser^ (entries (... ...)) config next fail |
| 125 |
orig* |
| 126 |
[name* (arg** ...) clause** ...] ...)])))])))) |
| 127 |
|
| 128 |
(define (mkrec0 n0 n1) |
| 129 |
(cond |
| 130 |
[(not n0) (make-rectangular 0 n1)] |
| 131 |
[(and (pair? n0) (eq? (car n0) 'polar)) |
| 132 |
(make-polar (cdr n0) n1)] |
| 133 |
[else (make-rectangular n0 n1)])) |
| 134 |
(define (mkrec1 n0 n1) |
| 135 |
(cond |
| 136 |
[(not n0) n1] |
| 137 |
[(and (pair? n0) (eq? (car n0) 'polar)) |
| 138 |
(make-polar (cdr n0) n1)] |
| 139 |
[else (make-rectangular n0 n1)])) |
| 140 |
|
| 141 |
|
| 142 |
(define-parser define-string->number-parser next fail |
| 143 |
|
| 144 |
(u:ratio+ (r n0 ex sn num ac) |
| 145 |
[(eof) |
| 146 |
(if (or n0 (= ac 0)) |
| 147 |
(fail) |
| 148 |
(do-sn/ex sn ex (/ num ac)))] |
| 149 |
[(digit r) => d |
| 150 |
(next u:ratio+ r n0 ex sn num (+ (* ac r) d))] |
| 151 |
[(sign) => sn2 |
| 152 |
(if (or n0 (= ac 0)) |
| 153 |
(fail) |
| 154 |
(let ([real (do-sn/ex sn ex (/ num ac))]) |
| 155 |
(next u:sign r real ex sn2)))] |
| 156 |
[(#\@) |
| 157 |
(if (or n0 (= ac 0)) |
| 158 |
(fail) |
| 159 |
(let ([mag (do-sn/ex sn ex (/ num ac))]) |
| 160 |
(next u:polar r mag ex)))] |
| 161 |
[(#\i) |
| 162 |
(if (= ac 0) |
| 163 |
(fail) |
| 164 |
(next u:done (mkrec0 n0 (do-sn/ex sn ex (/ num ac)))))]) |
| 165 |
|
| 166 |
(u:ratio (r n0 ex sn num) |
| 167 |
[(digit r) => d |
| 168 |
(next u:ratio+ r n0 ex sn num d)]) |
| 169 |
|
| 170 |
(u:done (n) |
| 171 |
[(eof) n]) |
| 172 |
|
| 173 |
(u:polar (r mag ex) |
| 174 |
[(digit r) => d |
| 175 |
(next u:digit+ r (cons 'polar mag) ex +1 d)] |
| 176 |
[(#\.) |
| 177 |
(if (= r 10) |
| 178 |
(next u:dot r (cons 'polar mag) ex +1) |
| 179 |
(fail))] |
| 180 |
[(sign) => sn |
| 181 |
(next u:sign r (cons 'polar mag) ex sn)]) |
| 182 |
|
| 183 |
(u:exponent+digit (r n0 ex sn ac exp1 exp2 exp-sign) |
| 184 |
[(eof) |
| 185 |
(if (number? n0) |
| 186 |
(fail) |
| 187 |
(mkrec1 n0 (do-dec-sn/ex sn ex |
| 188 |
(* ac (expt 10 (+ exp1 (* exp2 exp-sign)))))))] |
| 189 |
[(digit r) => d |
| 190 |
(next u:exponent+digit r n0 ex sn ac exp1 (+ (* exp2 r) d) exp-sign)] |
| 191 |
[(sign) => sn2 |
| 192 |
(if n0 |
| 193 |
(fail) |
| 194 |
(let ([real (do-dec-sn/ex sn ex (* ac (expt 10 (+ exp1 (* exp2 exp-sign)))))]) |
| 195 |
(next u:sign r real ex sn2)))] |
| 196 |
[(#\@) |
| 197 |
(if n0 |
| 198 |
(fail) |
| 199 |
(let ([mag (do-dec-sn/ex sn ex (* ac (expt 10 (+ exp1 (* exp2 exp-sign)))))]) |
| 200 |
(next u:polar r mag ex)))] |
| 201 |
[(#\i) |
| 202 |
(let ([n1 (do-dec-sn/ex sn ex |
| 203 |
(* ac (expt 10 (+ exp1 (* exp2 exp-sign)))))]) |
| 204 |
(next u:done (mkrec0 n0 n1)))] |
| 205 |
[(#\|) |
| 206 |
(let ([n1 (do-dec-sn/ex sn ex |
| 207 |
(* ac (expt 10 (+ exp1 (* exp2 exp-sign)))))]) |
| 208 |
(next u:mant r n0 n1 ex))]) |
| 209 |
|
| 210 |
(u:exponent+sign (r n0 ex sn ac exp1 exp-sign) |
| 211 |
[(digit r) => d |
| 212 |
(next u:exponent+digit r n0 ex sn ac exp1 d exp-sign)]) |
| 213 |
|
| 214 |
(u:exponent (r n0 ex sn ac exp1) |
| 215 |
[(digit r) => d |
| 216 |
(next u:exponent+digit r n0 ex sn ac exp1 d +1)] |
| 217 |
[(sign) => sn2 (next u:exponent+sign r n0 ex sn ac exp1 sn2)]) |
| 218 |
|
| 219 |
(u:digit+dot (r n0 ex sn ac exp) |
| 220 |
[(eof) |
| 221 |
(if (and n0 (not (pair? n0))) |
| 222 |
(fail) |
| 223 |
(mkrec1 n0 (do-dec-sn/ex sn ex (* ac (expt 10 exp))))) |
| 224 |
;;; (mkrec1 n0 (do-dec-sn/ex sn ex (* ac (expt 10 exp)))) |
| 225 |
] |
| 226 |
[(digit r) => d |
| 227 |
(next u:digit+dot r n0 ex sn (+ (* ac r) d) (- exp 1))] |
| 228 |
[(#\i) |
| 229 |
(let ([n1 (do-dec-sn/ex sn ex (* ac (expt 10 exp)))]) |
| 230 |
(next u:done (mkrec0 n0 n1)))] |
| 231 |
[(sign) => sn2 |
| 232 |
(if n0 |
| 233 |
(fail) |
| 234 |
(let ([real (do-dec-sn/ex sn ex (* ac (expt 10 exp)))]) |
| 235 |
(next u:sign r real ex sn2)))] |
| 236 |
[(#\@) |
| 237 |
(if n0 |
| 238 |
(fail) |
| 239 |
(let ([mag (do-dec-sn/ex sn ex (* ac (expt 10 exp)))]) |
| 240 |
(next u:polar r mag ex)))] |
| 241 |
[(#\e #\E #\s #\S #\f #\F #\d #\D #\l #\L) |
| 242 |
(if (fx=? r 10) |
| 243 |
(next u:exponent r n0 ex sn ac exp) |
| 244 |
(fail))] |
| 245 |
[(#\|) |
| 246 |
(let ([n1 (do-dec-sn/ex sn ex (* ac (expt 10 exp)))]) |
| 247 |
(next u:mant r n0 n1 ex))] |
| 248 |
) |
| 249 |
|
| 250 |
|
| 251 |
(u:digit+ (r n0 ex sn ac) |
| 252 |
[(eof) |
| 253 |
(if (and n0 (not (pair? n0))) |
| 254 |
(fail) |
| 255 |
(mkrec1 n0 (do-sn/ex sn ex ac))) |
| 256 |
;;; (mkrec1 n0 (do-sn/ex sn ex ac)) |
| 257 |
] |
| 258 |
[(digit r) => d |
| 259 |
(next u:digit+ r n0 ex sn (+ (* ac r) d))] |
| 260 |
[(#\.) |
| 261 |
(if (fx=? r 10) |
| 262 |
(next u:digit+dot r n0 ex sn ac 0) |
| 263 |
(fail))] |
| 264 |
[(#\/) (next u:ratio r n0 ex sn ac)] |
| 265 |
[(sign) => sn2 |
| 266 |
(if n0 |
| 267 |
(fail) |
| 268 |
(let ([real (do-sn/ex sn ex ac)]) |
| 269 |
(next u:sign r real ex sn2)))] |
| 270 |
[(#\i) |
| 271 |
(next u:done (mkrec0 n0 (do-sn/ex sn ex ac)))] |
| 272 |
[(#\@) |
| 273 |
(if n0 |
| 274 |
(fail) |
| 275 |
(let ([mag (do-sn/ex sn ex ac)]) |
| 276 |
(next u:polar r mag ex)))] |
| 277 |
[(#\e #\E #\s #\S #\f #\F #\d #\D #\l #\L) |
| 278 |
(if (fx=? r 10) |
| 279 |
(next u:exponent r n0 ex sn ac 0) |
| 280 |
(fail))] |
| 281 |
[(#\|) |
| 282 |
(next u:mant r n0 (do-sn/ex sn 'i ac) ex)]) |
| 283 |
|
| 284 |
(u:mant (r n0 n1 ex) |
| 285 |
[(digit r) => d_ |
| 286 |
(next u:mant+ r n0 n1 ex)]) |
| 287 |
|
| 288 |
(u:mant+ (r n0 n1 ex) |
| 289 |
[(eof) (mkrec1 n0 n1)] |
| 290 |
[(digit r) => d_ |
| 291 |
(next u:mant+ r n0 n1 ex)] |
| 292 |
[(sign) => sn2 |
| 293 |
(if n0 (fail) (next u:sign r n1 ex sn2))] |
| 294 |
[(#\@) (if n0 (fail) (next u:polar r n1 ex))] |
| 295 |
[(#\i) (if (pair? n0) (fail) (next u:done (mkrec0 n0 n1)))]) |
| 296 |
|
| 297 |
(u:sign-i (r n0 ex sn) |
| 298 |
[(eof) (mkrec0 n0 (do-sn/ex sn ex 1))] |
| 299 |
[(#\n) (next u:sign-in r n0 (* sn +inf.0) ex)]) |
| 300 |
(u:sign-in (r n0 n1 ex) |
| 301 |
[(#\f) (next u:sign-inf r n0 n1 ex)]) |
| 302 |
(u:sign-inf (r n0 n1 ex) |
| 303 |
[(#\.) (next u:sign-inf. r n0 n1 ex)]) |
| 304 |
(u:sign-inf. (r n0 n1 ex) |
| 305 |
[(#\0) (next u:sign-inf.0 r n0 n1 ex)]) |
| 306 |
(u:sign-inf.0 (r n0 n1 ex) |
| 307 |
[(eof) (mkrec1 n0 n1)] |
| 308 |
[(sign) => sn2 |
| 309 |
(if n0 (fail) (next u:sign r n1 ex sn2))] |
| 310 |
[(#\@) (if n0 (fail) (next u:polar r n1 ex))] |
| 311 |
[(#\i) (next u:done (mkrec0 n0 n1))]) |
| 312 |
|
| 313 |
(u:dot (r n0 ex sn) |
| 314 |
[(digit r) => d |
| 315 |
(next u:digit+dot r n0 ex sn d -1)]) |
| 316 |
|
| 317 |
(u:sign (r n0 ex sn) |
| 318 |
[(digit r) => d |
| 319 |
(next u:digit+ r n0 ex sn d)] |
| 320 |
[(#\i) (next u:sign-i r n0 ex sn)] |
| 321 |
[(#\n) (next u:sign-n r n0 ex)] |
| 322 |
[(#\.) |
| 323 |
(if (= r 10) |
| 324 |
(next u:dot r n0 ex sn) |
| 325 |
(fail))]) |
| 326 |
|
| 327 |
(u:sign-n (r n0 ex) [(#\a) (next u:sign-na r n0 ex)]) |
| 328 |
(u:sign-na (r n0 ex) [(#\n) (next u:sign-nan r n0 ex)]) |
| 329 |
(u:sign-nan (r n0 ex) [(#\.) (next u:sign-nan. r n0 ex)]) |
| 330 |
(u:sign-nan. (r n0 ex) [(#\0) (next u:sign-nan.0 r n0 ex)]) |
| 331 |
(u:sign-nan.0 (r n0 ex) |
| 332 |
[(eof) (mkrec1 n0 +nan.0)] |
| 333 |
[(sign) => sn2 (if n0 (fail) (next u:sign r +nan.0 ex sn2))] |
| 334 |
[(#\@) (if n0 (fail) (next u:polar r +nan.0 ex))] |
| 335 |
[(#\i) (next u:done (mkrec0 n0 +nan.0))]) |
| 336 |
|
| 337 |
(parse-string-h (dr r ex) |
| 338 |
[(#\x #\X) |
| 339 |
(if r (fail) (next parse-string 16 16 ex))] |
| 340 |
[(#\o #\O) |
| 341 |
(if r (fail) (next parse-string 8 8 ex))] |
| 342 |
[(#\b #\B) |
| 343 |
(if r (fail) (next parse-string 2 2 ex))] |
| 344 |
[(#\d #\D) |
| 345 |
(if r (fail) (next parse-string 10 10 ex))] |
| 346 |
[(#\e #\E) |
| 347 |
(if ex (fail) (next parse-string dr r 'e))] |
| 348 |
[(#\i #\I) |
| 349 |
(if ex (fail) (next parse-string dr r 'i))]) |
| 350 |
|
| 351 |
(parse-string (dr r ex) |
| 352 |
[(#\#) (next parse-string-h dr r ex)] |
| 353 |
[(sign) => sn2 (next u:sign dr #f ex sn2)] |
| 354 |
[(#\.) |
| 355 |
(if (fx=? dr 10) |
| 356 |
(next u:dot dr #f ex +1) |
| 357 |
(fail))] |
| 358 |
[(digit dr) => d |
| 359 |
(next u:digit+ dr #f ex +1 d)]) |
| 360 |
) |
| 361 |
|
| 362 |
(define-syntax string-config |
| 363 |
(syntax-rules (EOF-ERROR GEN-TEST GEN-ARGS FAIL GEN-DELIM-TEST) |
| 364 |
[(_ GEN-ARGS k . rest) (k (s n i) . rest)] |
| 365 |
[(_ FAIL (s n i) c) #f] |
| 366 |
[(_ FAIL (s n i)) #f] |
| 367 |
[(_ EOF-ERROR (s n i)) #f] |
| 368 |
[(_ GEN-DELIM-TEST c sk fk) #f] |
| 369 |
[(_ GEN-TEST var next fail (s n i) sk fk) |
| 370 |
(let () |
| 371 |
(define-syntax fail |
| 372 |
(syntax-rules () |
| 373 |
[(_) #f])) |
| 374 |
(if (fx=? i n) |
| 375 |
sk |
| 376 |
(let ([var (string-ref s i)]) |
| 377 |
(define-syntax next |
| 378 |
(syntax-rules () |
| 379 |
[(_ who args (... ...)) |
| 380 |
(who s n (fx+ i 1) args (... ...))])) |
| 381 |
fk)))])) |
| 382 |
|
| 383 |
(define-string->number-parser string-config (parse-string)) |
| 384 |
|
| 385 |
(define string->number |
| 386 |
(case-lambda |
| 387 |
[(s) |
| 388 |
(unless (string? s) (die who "not a string" s)) |
| 389 |
(parse-string s (string-length s) 0 10 #f #f)] |
| 390 |
[(s r) |
| 391 |
(unless (string? s) (die who "not a string" s)) |
| 392 |
(unless (memv r '(10 16 2 8)) (die who "invalid radix" r)) |
| 393 |
(parse-string s (string-length s) 0 r #f #f)])) |
| 394 |
|
| 395 |
) |
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
;;; <number> ::= <num 2> |
| 400 |
;;; | <num 8> |
| 401 |
;;; | <num 10> |
| 402 |
;;; | <num 16> |
| 403 |
;;; <num R> ::= <prefix R> <complex R> |
| 404 |
;;; <complex R> ::= <real R> |
| 405 |
;;; | <real R> "@" <real R> |
| 406 |
;;; | <real R> "+" <ureal R> "i" |
| 407 |
;;; | <real R> "-" <ureal R> "i" |
| 408 |
;;; | <real R> "+" <naninf> "i" |
| 409 |
;;; | <real R> "-" <naninf> "i" |
| 410 |
;;; | <real R> "+" "i" |
| 411 |
;;; | <real R> "-" "i" |
| 412 |
;;; | "+" <ureal R> "i" |
| 413 |
;;; | "-" <ureal R> "i" |
| 414 |
;;; | "+" <naninf> "i" |
| 415 |
;;; | "-" <naninf> "i" |
| 416 |
;;; | "+" "i" |
| 417 |
;;; | "-" "i" |
| 418 |
;;; <real R> ::= <sign> <ureal R> |
| 419 |
;;; | "+" <naninf> |
| 420 |
;;; | "-" <naninf> |
| 421 |
;;; <naninf> ::= "nan.0" |
| 422 |
;;; | "inf.0" |
| 423 |
;;; <ureal R> | <uinteger R> |
| 424 |
;;; | <uinteger R> "/" <uinteger R> |
| 425 |
;;; | <decimal R> <mantissa width> |
| 426 |
;;; <decimal 10> ::= <uinteger 10> <suffix> |
| 427 |
;;; | "." <digit 10> + <suffix> |
| 428 |
;;; | <digit 10> + "." <digit 10> * <suffix> |
| 429 |
;;; | <digit 10> + "." <suffix> |
| 430 |
;;; <uinteger R> ::= <digit R> + |
| 431 |
;;; <prefix R> | <radix R> <exactness> |
| 432 |
;;; | <exactness <radix R> |
| 433 |
;;; <suffix> ::= epsilon |
| 434 |
;;; | <exponent-marker> <sign> <digit 10> + |
| 435 |
;;; <exponent-marker> ::= "e" |
| 436 |
;;; | "E" |
| 437 |
;;; | "s" |
| 438 |
;;; | "S" |
| 439 |
;;; | "f" |
| 440 |
;;; | "F" |
| 441 |
;;; | "d" |
| 442 |
;;; | "D" |
| 443 |
;;; | "l" |
| 444 |
;;; | "L" |
| 445 |
;;; <mantissa-width> ::= epsilon |
| 446 |
;;; | "|" <digit +> |
| 447 |
;;; <sign> ::= epsilon |
| 448 |
;;; | "+" |
| 449 |
;;; | "-" |
| 450 |
;;; <exactness> ::= epsilon |
| 451 |
;;; | "#i" |
| 452 |
;;; | "#I" |
| 453 |
;;; | "#e" |
| 454 |
;;; | "#E" |
| 455 |
;;; <radix-2> ::= "#b" |
| 456 |
;;; | "#B" |
| 457 |
;;; <radix-8> ::= "#o" |
| 458 |
;;; | "#O" |
| 459 |
;;; <radix-10> ::= epsilon |
| 460 |
;;; | "#d" |
| 461 |
;;; | "#D" |
| 462 |
;;; <radix-16> ::= "#x" |
| 463 |
;;; | "#X" |
| 464 |
;;; <digit-2> ::= "0" |
| 465 |
;;; | "1" |
| 466 |
;;; <digit-8> ::= "0" |
| 467 |
;;; | "1" |
| 468 |
;;; | "2" |
| 469 |
;;; | "3" |
| 470 |
;;; | "4" |
| 471 |
;;; | "5" |
| 472 |
;;; | "6" |
| 473 |
;;; | "7" |
| 474 |
;;; <digit-10> ::= <digit> |
| 475 |
;;; <digit-16> ::= <hex-digit> |
| 476 |
;;; <digit> ::= "0" |
| 477 |
;;; | "1" |
| 478 |
;;; | "2" |
| 479 |
;;; | "3" |
| 480 |
;;; | "4" |
| 481 |
;;; | "5" |
| 482 |
;;; | "6" |
| 483 |
;;; | "7" |
| 484 |
;;; | "8" |
| 485 |
;;; | "9" |
| 486 |
;;; <hex-digit> ::= <hex> |
| 487 |
;;; | "A" |
| 488 |
;;; | "B" |
| 489 |
;;; | "C" |
| 490 |
;;; | "D" |
| 491 |
;;; | "E" |
| 492 |
;;; | "F" |
| 493 |
;;; | "a" |
| 494 |
;;; | "b" |
| 495 |
;;; | "c" |
| 496 |
;;; | "d" |
| 497 |
;;; | "e" |
| 498 |
;;; | "f" |