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.
23 lines
461 B
Racket
23 lines
461 B
Racket
#lang racket/base
|
|
|
|
|
|
(require racket/contract/base)
|
|
|
|
|
|
(provide
|
|
(struct-out terminal-symbol)
|
|
(struct-out nonterminal-symbol)
|
|
(contract-out
|
|
[grammar-symbol? predicate/c]))
|
|
|
|
|
|
;@----------------------------------------------------------------------------------------------------
|
|
|
|
|
|
(define (grammar-symbol? v)
|
|
(or (terminal-symbol? v) (nonterminal-symbol? v)))
|
|
|
|
|
|
(struct terminal-symbol (value) #:transparent)
|
|
(struct nonterminal-symbol (value) #:transparent)
|