From 0c976a1634814d98b11801776977b5390563a570 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 3 May 2016 12:51:33 -0700 Subject: [PATCH] resume in world-sexp --- beautiful-racket/br/demo/txtadv/expander.rkt | 24 +++++------------ beautiful-racket/br/demo/txtadv/parser.rkt | 28 +++++++------------- 2 files changed, 15 insertions(+), 37 deletions(-) diff --git a/beautiful-racket/br/demo/txtadv/expander.rkt b/beautiful-racket/br/demo/txtadv/expander.rkt index c53c914..2a1e02b 100644 --- a/beautiful-racket/br/demo/txtadv/expander.rkt +++ b/beautiful-racket/br/demo/txtadv/expander.rkt @@ -35,10 +35,10 @@ #'(module-begin _section ...)) (provide verb-section) -(define-inverting #'(verb-section _heading _verb-entry ...) +(define-inverting #'(verb-section _heading _verb-item ...) (inject-syntax ([#'in-verbs (shared-syntax 'in-verbs)]) #'(define-verbs in-verbs - _verb-entry ...))) + _verb-item ...))) (provide verb-item) (define-inverting #'(verb-item (_name0 _transitive0?) (_name _transitive?) ... _desc) @@ -57,22 +57,18 @@ #'(define-everywhere everywhere-actions ([_name _desc] ...))) -(provide everywhere-item) -(define-inverting #'(everywhere-item _name _desc) - #'(_name _desc)) +(provide id-desc) +(define-inverting #'(id-desc _id _desc) + #'(_id _desc)) (provide things-section) (define-inverting #'(things-section _heading _thing ...) #'(begin _thing ...)) (provide thing-item) -(define-inverting #'(thing-item (thing-id _thingname) (_actionname _actiondesc) ...) +(define-inverting #'(thing-item _thingname (_actionname _actiondesc) ...) #'(define-thing _thingname [_actionname _actiondesc] ...)) -(provide thing-action) -(define-inverting #'(thing-action _actionname _actiondesc) - #'(_actionname _actiondesc)) - (provide places-section) (define-inverting #'(places-section _heading _placeitem ...) #'(begin _placeitem ...)) @@ -81,9 +77,6 @@ (define-inverting #'(place-item _place-id _place-desc [_place-item ...] [_actionname _actiondesc] ...) #'(define-place _place-id _place-desc [_place-item ...] ([_actionname _actiondesc] ...))) -(provide place-id) -(define #'(place-id _id) #'_id) - (provide place-descrip) (define #'(place-descrip _desc) #'_desc) @@ -95,11 +88,6 @@ [#'(_ "," _id) #'_id] [#'(_ _id) #'_id]) -(provide place-action) -(define-inverting #'(place-action _id _desc) #'(_id _desc)) - -(provide desc) -(define #'(desc _d) #'_d) (provide s-exp) (define-cases-inverting #'s-exp diff --git a/beautiful-racket/br/demo/txtadv/parser.rkt b/beautiful-racket/br/demo/txtadv/parser.rkt index cc0bb9d..14c576a 100644 --- a/beautiful-racket/br/demo/txtadv/parser.rkt +++ b/beautiful-racket/br/demo/txtadv/parser.rkt @@ -1,41 +1,31 @@ #lang ragg -txtadv-program : [verb-section] [everywhere-section] [things-section] places-section start-section +txtadv-program : verb-section everywhere-section things-section places-section start-section verb-section : "===VERBS===" verb-item+ -verb-item : verb-name+ desc +verb-item : verb-name+ s-exp verb-name : [","] ID ["_"] -everywhere-section : "===EVERYWHERE===" everywhere-item+ - -everywhere-item : ID desc +everywhere-section : "===EVERYWHERE===" id-desc+ things-section : "===THINGS===" thing-item+ -thing-item : thing-id thing-action+ - -thing-id : DASHED-NAME - -thing-action : ID desc +thing-item : DASHED-NAME id-desc+ places-section : "===PLACES===" place-item+ -place-item : place-id place-descrip place-items place-action+ +place-item : DASHED-NAME place-descrip place-items id-desc+ -place-id : DASHED-NAME +place-descrip : STRING ; `place-desc` is already used in expander -place-descrip : STRING ; place-desc is already used in expander - -place-items : "[" place-name* "]" ; place-things is already used +place-items : "[" place-name* "]" ; `place-things` is already used place-name : [","] ID -place-action : ID desc - start-section : "===START===" place-name -desc : s-exp +id-desc : ID s-exp -s-exp : ID | STRING | ("(" | "[" | "{") s-exp* (")" | "]" | "}") \ No newline at end of file +s-exp : ID | STRING | "(" s-exp* ")" \ No newline at end of file