From 12438d29002adc0fd1ddee40fe235e11859c348e Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 16 Sep 2016 10:49:22 -0700 Subject: [PATCH] notes for later --- beautiful-racket/br/demo/hdl/bus.rkt | 4 ++-- beautiful-racket/br/demo/hdl/tokenizer.rkt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/beautiful-racket/br/demo/hdl/bus.rkt b/beautiful-racket/br/demo/hdl/bus.rkt index 4858a96..e72b74f 100644 --- a/beautiful-racket/br/demo/hdl/bus.rkt +++ b/beautiful-racket/br/demo/hdl/bus.rkt @@ -33,7 +33,7 @@ (reverse (for/list ([i (in-range width)]) (bitwise-bit-field int i (add1 i))))) -(define max-bus-width 16) +(define max-bus-width 64) (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)) (impersonate-procedure (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))) #,(when (syntax-property caller-stx 'writer) (with-pattern diff --git a/beautiful-racket/br/demo/hdl/tokenizer.rkt b/beautiful-racket/br/demo/hdl/tokenizer.rkt index 0ba1cef..25a350d 100644 --- a/beautiful-racket/br/demo/hdl/tokenizer.rkt +++ b/beautiful-racket/br/demo/hdl/tokenizer.rkt @@ -18,8 +18,9 @@ [(char-set "[]{}(),;=.") lexeme] ["true" (token 'TRUE #t)] ["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))] + ; 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))])) (get-token input-port)) next-token)