diff --git a/beautiful-racket/br/demo/hdl/expander.rkt b/beautiful-racket/br/demo/hdl/expander.rkt index 28d5146..5ff08bb 100644 --- a/beautiful-racket/br/demo/hdl/expander.rkt +++ b/beautiful-racket/br/demo/hdl/expander.rkt @@ -1,32 +1,32 @@ #lang br (provide #%top-interaction #%module-begin (all-defined-out)) -(define-inverting #'(chip-program "CHIP" _arg ...) +(define #'(chip-program "CHIP" _arg ...) #'(chip _arg ...)) -(define-inverting #'(pin-spec _label _pin-list ";") +(define #'(pin-spec _label _pin-list ";") #'_pin-list) -(define-inverting #'(pin-list _id _comma-id ...) - #'(_id _comma-id ...)) +(define-inverting #'(pin-list _id _another-id ...) + #'(_id _another-id ...)) -(define-inverting #'(comma-id "," _id) +(define #'(another-id "," _id) #'_id) -(define-inverting #'(part-spec "PARTS:" _part-list) +(define #'(part-spec "PARTS:" _part-list) #'_part-list) -(define-inverting #'(part-list _part ...) +(define #'(part-list _part ...) #'(begin _part ...)) -(define-inverting #'(part _partname "(" _firstpin "=" _firstval _commaidpair ... (_lastpin _pinout) ")" ";") +(define-inverting #'(part _partname "(" _firstpin "=" _firstval _another-id-pair ... (_lastpin _pinout) ")" ";") #'(begin - (define _pinout (call-part _partname [_firstpin _firstval] _commaidpair ...)))) + (define _pinout (call-part _partname [_firstpin _firstval] _another-id-pair ...)))) -(define #'(comma-id-pair "," _firstid "=" _secondid) +(define #'(another-id-pair "," _firstid "=" _secondid) #'(_firstid _secondid)) -(define-inverting #'(call-part _Part [_pin-in _val-id] ...) +(define #'(call-part _Part [_pin-in _val-id] ...) (with-syntax ([part-path (format "~a.hdl" (syntax->datum #'_Part))] [(kw ...) (map (λ(pi) (string->keyword (format "~a" (syntax->datum pi)))) (syntax->list #'(_pin-in ...)))]) #'(let () diff --git a/beautiful-racket/br/demo/hdl/parser.rkt b/beautiful-racket/br/demo/hdl/parser.rkt index 00b2c98..cc35eb7 100644 --- a/beautiful-racket/br/demo/hdl/parser.rkt +++ b/beautiful-racket/br/demo/hdl/parser.rkt @@ -4,14 +4,14 @@ chip-program : "CHIP" ID "{" pin-spec pin-spec part-spec "}" pin-spec : ("IN" | "OUT") pin-list ";" -pin-list : ID comma-id* +pin-list : ID another-id* -comma-id : "," ID +another-id : "," ID part-spec : "PARTS:" part-list part-list : part+ -part : ID "(" ID "=" ID comma-id-pair* ")" ";" +part : ID "(" ID "=" ID another-id-pair* ")" ";" -comma-id-pair : "," ID "=" ID \ No newline at end of file +another-id-pair : "," ID "=" ID \ No newline at end of file