refine inversion
parent
a6de2888d9
commit
283e74446b
@ -1,17 +1,21 @@
|
||||
#lang ragg
|
||||
|
||||
chip-program : "CHIP" ID "{" pin-spec pin-spec part-spec "}"
|
||||
|
||||
pin-spec : ("IN" | "OUT") pin-list ";"
|
||||
;; rule of thumb: use [optional] bits judiciously as they multiply the cases needed for a production rule
|
||||
;; rule of thumb: for a set of related IDs, put each into the same grammar entity
|
||||
;; rule of thumb: avoid mushing unrelated IDs into one grammar entity
|
||||
;; whereas a * corresponds directly to an ... in the expander macro
|
||||
;; syntax patterns are good for
|
||||
;; + single case / nonrecursive structure
|
||||
;; + nonalternating pattern (no "this that this that ...")
|
||||
|
||||
pin-list : ID another-id*
|
||||
chip-program : "CHIP" ID "{" pin-spec pin-spec part-spec "}"
|
||||
|
||||
another-id : "," ID
|
||||
pin-spec : ("IN" | "OUT") pin+ ";"
|
||||
|
||||
part-spec : "PARTS:" part-list
|
||||
pin : ID [","]
|
||||
|
||||
part-list : part+
|
||||
part-spec : "PARTS:" part+
|
||||
|
||||
part : ID "(" ID "=" ID another-id-pair* ")" ";"
|
||||
part : ID "(" pin-val-pair+ ")" ";"
|
||||
|
||||
another-id-pair : "," ID "=" ID
|
||||
pin-val-pair : ID "=" ID [","]
|
Loading…
Reference in New Issue