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

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

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

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

Loading…
Cancel
Save