You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
beautiful-racket/beautiful-racket-demo/hdl/parser.rkt

32 lines
561 B
Racket

#lang brag
9 years ago
chip-program : /"CHIP" chipname /"{" in-spec out-spec part-spec /"}"
9 years ago
9 years ago
@chipname : ID
in-spec : pin-spec
out-spec : pin-spec
@pin-spec : (/"IN" | /"OUT") pin [/"," pin]* /";"
9 years ago
/pin : ID [/"[" NUMBER /"]"]
9 years ago
9 years ago
@part-spec : /"PARTS:" part+
9 years ago
part : partname /"(" wire-assign [/"," wire-assign]* /")" /";"
9 years ago
9 years ago
@partname : ID
9 years ago
/wire-assign : pin-range /"=" pin-val
9 years ago
/pin-range : ID [/"[" bus-range /"]"]
9 years ago
@bus-range : number [/"." /"." number]
@pin-val : pin-range
| BINARY-NUMBER
| TRUE
| FALSE
@number : BINARY-NUMBER | NUMBER