notes for later

pull/2/head
Matthew Butterick 8 years ago
parent f30922a7dc
commit 12438d2900

@ -33,7 +33,7 @@
(reverse (for/list ([i (in-range width)]) (reverse (for/list ([i (in-range width)])
(bitwise-bit-field int i (add1 i))))) (bitwise-bit-field int i (add1 i)))))
(define max-bus-width 16) (define max-bus-width 64)
(define default-bus-width 1) (define default-bus-width 1)
@ -116,7 +116,7 @@ base bus:
(raise-argument-error 'id (format "bus width <= max width ~a" max-bus-width) bus-width)) (raise-argument-error 'id (format "bus width <= max width ~a" max-bus-width) bus-width))
(impersonate-procedure (impersonate-procedure
(let ([reader (make-bus-reader 'id bus-width)]) (let ([reader (make-bus-reader 'id bus-width)])
(procedure-rename (λ args (apply reader (ID-THUNK) args)) (string->symbol (format "~a, a bus of width ~a" 'ID bus-width)))) (procedure-rename (λ args (apply reader (ID-THUNK) args)) (string->symbol (format "~a:~a-bit" 'ID bus-width))))
#f BUS-TYPE #t))) #f BUS-TYPE #t)))
#,(when (syntax-property caller-stx 'writer) #,(when (syntax-property caller-stx 'writer)
(with-pattern (with-pattern

@ -18,8 +18,9 @@
[(char-set "[]{}(),;=.") lexeme] [(char-set "[]{}(),;=.") lexeme]
["true" (token 'TRUE #t)] ["true" (token 'TRUE #t)]
["false" (token 'FALSE #f)] ["false" (token 'FALSE #f)]
[(repetition 1 +inf.0 (char-set "01")) (token 'BINARY-NUMBER (string->number lexeme 2))]
[(repetition 1 +inf.0 numeric) (token 'NUMBER (string->number lexeme))] [(repetition 1 +inf.0 numeric) (token 'NUMBER (string->number lexeme))]
; bugaboo: "10" is ambiguous: number or binary number?
[(repetition 1 +inf.0 (char-set "01")) (token 'BINARY-NUMBER (string->number lexeme 2))]
[(seq (repetition 1 1 alphabetic) (repetition 0 +inf.0 (union alphabetic numeric "-"))) (token 'ID (string->symbol lexeme))])) [(seq (repetition 1 1 alphabetic) (repetition 0 +inf.0 (union alphabetic numeric "-"))) (token 'ID (string->symbol lexeme))]))
(get-token input-port)) (get-token input-port))
next-token) next-token)

Loading…
Cancel
Save