pull/10/head
Matthew Butterick 8 years ago
parent 5b894d8ae8
commit 1dc08fbe92

@ -120,8 +120,8 @@ base bus:
#f BUS-TYPE #t))) #f BUS-TYPE #t)))
#,(when (syntax-property caller-stx 'writer) #,(when (syntax-property caller-stx 'writer)
(with-pattern (with-pattern
([_id-write (suffix-id #'ID "-write")]) ([ID-WRITE (suffix-id #'ID "-write")])
#'(define _id-write #'(define ID-WRITE
(let ([writer (make-bus-writer 'id-write bus-width)]) (let ([writer (make-bus-writer 'id-write bus-width)])
(λ args (λ args
(define result (apply writer (ID-THUNK) args)) (define result (apply writer (ID-THUNK) args))
@ -191,9 +191,10 @@ input bus:
[(MACRO-NAME ID) [(MACRO-NAME ID)
#'(MACRO-NAME ID default-bus-width)] #'(MACRO-NAME ID default-bus-width)]
[(MACRO-NAME ID BUS-WIDTH) [(MACRO-NAME ID BUS-WIDTH)
(syntax-property* #'(define-base-bus ID (λ () 0) BUS-WIDTH) (syntax-property
['impersonate #'input-bus] (syntax-property #'(define-base-bus ID (λ () 0) BUS-WIDTH)
['writer #t])]) 'impersonate #'input-bus)
'writer #t)])
(module+ test (module+ test
(define-input-bus ib 4) (define-input-bus ib 4)

@ -1,6 +1,6 @@
#lang br #lang br
(require br/reader-utils "parser.rkt" "tokenizer.rkt") (require "parser.rkt" "tokenizer.rkt")
(provide read-syntax)
(define-read-and-read-syntax (source-path input-port) (define (read-syntax source-path input-port)
#`(module hdl-mod hdl-demo/expander #`(module hdl-mod hdl-demo/expander
#,(parse source-path (tokenize input-port)))) #,(parse source-path (tokenize input-port))))

@ -1,8 +1,9 @@
#lang br #lang br
(module reader br (module reader br
(require br/reader-utils "parser.rkt" "tokenizer.rkt") (require "parser.rkt" "tokenizer.rkt")
(define-read-and-read-syntax (source-path port) (provide read-syntax)
(define (read-syntax source-path port)
(define-values (line col pos) (port-next-location port)) (define-values (line col pos) (port-next-location port))
(define port+newline (input-port-append #f port (open-input-string "\n"))) (define port+newline (input-port-append #f port (open-input-string "\n")))
(port-count-lines! port+newline) (port-count-lines! port+newline)

Loading…
Cancel
Save