Move symbols into their own module too

remotes/jackfirth/master
Jack Firth 3 years ago
parent b2611aee1b
commit 60a142f90c

@ -5,12 +5,9 @@
(provide (provide
(struct-out terminal-symbol)
(struct-out nonterminal-symbol)
(struct-out cf-grammar) (struct-out cf-grammar)
(struct-out cf-production-rule) (struct-out cf-production-rule)
(contract-out (contract-out
[grammar-symbol? predicate/c]
[cf-grammar-start-rules (-> cf-grammar? (set/c cf-production-rule? #:kind 'immutable))] [cf-grammar-start-rules (-> cf-grammar? (set/c cf-production-rule? #:kind 'immutable))]
[make-cf-grammar (-> #:rules (sequence/c cf-production-rule?) #:start-symbol any/c cf-grammar?)] [make-cf-grammar (-> #:rules (sequence/c cf-production-rule?) #:start-symbol any/c cf-grammar?)]
[make-cf-production-rule [make-cf-production-rule
@ -22,7 +19,8 @@
racket/set racket/set
rebellion/collection/vector rebellion/collection/vector
yaragg/base/derivation yaragg/base/derivation
yaragg/base/semantic-action) yaragg/base/semantic-action
yaragg/base/symbol)
;@---------------------------------------------------------------------------------------------------- ;@----------------------------------------------------------------------------------------------------
@ -52,15 +50,6 @@
(struct cf-production-rule (nonterminal action substitution) #:transparent) (struct cf-production-rule (nonterminal action substitution) #:transparent)
;; A (Grammar-Symbol T S) is either a (Terminal-Symbol T) or a (Nonterminal-Symbol S)
(define (grammar-symbol? v)
(or (terminal-symbol? v) (nonterminal-symbol? v)))
(struct terminal-symbol (value) #:transparent)
(struct nonterminal-symbol (value) #:transparent)
(define (make-cf-grammar #:rules rules #:start-symbol start) (define (make-cf-grammar #:rules rules #:start-symbol start)
(cf-grammar (sequence->vector rules) start)) (cf-grammar (sequence->vector rules) start))

@ -0,0 +1,22 @@
#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)

@ -18,6 +18,8 @@
rebellion/private/guarded-block rebellion/private/guarded-block
yaragg/base/derivation yaragg/base/derivation
yaragg/base/grammar yaragg/base/grammar
yaragg/base/semantic-action
yaragg/base/symbol
yaragg/base/token yaragg/base/token
yaragg/parser yaragg/parser
(submod yaragg/parser private)) (submod yaragg/parser private))

Loading…
Cancel
Save