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.
21 lines
479 B
Racket
21 lines
479 B
Racket
9 years ago
|
#lang ragg
|
||
|
;; use uppercase TOKEN-IDENTIFIERS for classes of tokens
|
||
|
;; too numerous to indicate individually
|
||
|
;; (e.g., numbers, strings)
|
||
|
|
||
|
bf-program : (op | loop)*
|
||
|
op : ">" | "<" | "+" | "-" | "." | ","
|
||
|
loop : "[" (op | loop)* "]"
|
||
|
|
||
|
|
||
|
;; Alternate ways of specifying grammar
|
||
|
;; bf-program : op*
|
||
|
;; op : ">" | "<" | "+" | "-" | "." | "," | loop
|
||
|
;; loop : "[" op* "]"
|
||
|
|
||
|
;; bf-program : expr*
|
||
|
;; expr : op | loop
|
||
|
;; op : ">" | "<" | "+" | "-" | "." | ","
|
||
|
;; loop : "[" bf-program "]"
|
||
|
|