Skip to content

Commit

Permalink
{} -> (scope)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelballantyne committed May 6, 2024
1 parent ad110af commit bac8674
Show file tree
Hide file tree
Showing 44 changed files with 105 additions and 105 deletions.
2 changes: 1 addition & 1 deletion demos/strumienta-talk/csv-demo/state-machine.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
(machine #:initial-state init:state-name
#:states s:state-spec ...
#:shared-events e:event-spec ...)
#:binding { (import s) init e }
#:binding (scope (import s) init e)

#'(compile-machine (machine #:initial-state init
#:states s ...
Expand Down
4 changes: 2 additions & 2 deletions demos/visser-symposium/state-machine.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

(host-interface/expression
(machine #:initial-state s:state-name d:machine-decl ...)
#:binding {(import d) s}
#:binding (scope (import d) s)
#'(compile-machine s d ...))

(nonterminal/exporting machine-decl
Expand All @@ -23,4 +23,4 @@
(on (evt:id arg:racket-var ...)
e:racket-expr ...
((~datum ->) s:state-name))
#:binding {(bind arg) e}))
#:binding (scope (bind arg) e)))
2 changes: 1 addition & 1 deletion demos/zed-talk/micro-mk2b.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(or2 g1:goal g2:goal)

(exists (x:term-variable ...) b:goal)
#:binding {(bind x) b})
#:binding (scope (bind x) b))

(nonterminal term
n:number
Expand Down
Binary file modified demos/zed-talk/micro-mk3.rkt
Binary file not shown.
Binary file modified demos/zed-talk/micro-mk4.rkt
Binary file not shown.
Binary file modified demos/zed-talk/micro-mk5.rkt
Binary file not shown.
8 changes: 4 additions & 4 deletions design/staged-minikanren.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
(conj2 g1:goal g2:goal)

(fresh1 (x:term-variable) b:goal)
#:binding {(bind x) b}
#:binding (scope (bind x) b)

; new reified call datatype
(reify-call )
Expand Down Expand Up @@ -81,7 +81,7 @@
(conj2 g1:goal g2:goal)

(fresh1 (x:term-variable) b:goal)
#:binding {(bind x) b}
#:binding (scope (bind x) b)

; new reified call datatype
(lreify-call )
Expand All @@ -99,12 +99,12 @@

(nonterminal condg-clause
([x:term-variable ...] [guard:goal] [body:goal])
#:binding {(bind x) guard body})
#:binding (scope (bind x) guard body))

(host-interface/definition
(defrel/condg (r:relation-name arg:term-variable ...)
clause:condg-clause ...)
#:binding [(export r) {(bind arg) clause}]
#:binding [(export r) (scope (bind arg) clause)]

#:lhs [#'r]
#:rhs [#'(void)]))
Expand Down
10 changes: 5 additions & 5 deletions design/statecharts-full.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

(nonterminal/exporting state-body
(initial n:state-name)
#:binding {n}
#:binding (scope n)

e:event

Expand All @@ -19,15 +19,15 @@

(state n:state-name
sb:state-body ...)
#:binding [(export n) {(import sb)}]
#:binding [(export n) (scope (import sb))]

(use scn:statechart-name #:as sn:state-name
e:event ...))

(nonterminal event
(on (evt:id arg:var ...)
ab:action ...+)
#:binding {(bind arg) ab}
#:binding (scope (bind arg) ab)

(on-enter ab:action ...)
(on-exit ab:action ...))
Expand All @@ -44,12 +44,12 @@

(nonterminal/nesting binding-group (tail)
[v:var e:racket-expr]
#:binding {(bind v) tail})
#:binding (scope (bind v) tail))

#;(host-interface/definition
(define-statechart n:statechart-name
sb:state-body)
#:binding [(export n) {(import sb)}])
#:binding [(export n) (scope (import sb))])

(host-interface/expression
(machine st:statechart-name)
Expand Down
10 changes: 5 additions & 5 deletions design/statecharts-smaller.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@

(nonterminal/exporting state-body
(initial n:state-name)
#:binding {n}
#:binding (scope n)

e:event

(state n:state-name
sb:state-body ...)
#:binding [(export n) {(import sb)}]
#:binding [(export n) (scope (import sb))]

(use scn:statechart-name #:as sn:state-name
e:event ...))

(nonterminal event
(on (evt:id arg:var ...)
ab:action ...+)
#:binding {(bind arg) ab})
#:binding (scope (bind arg) ab))

(nonterminal action
(-> s:state-name)
Expand All @@ -38,12 +38,12 @@

(nonterminal/nesting binding-group (tail)
[v:var e:racket-expr]
#:binding {(bind v) tail})
#:binding (scope (bind v) tail))

#;(host-interface/definition
(define-statechart n:statechart-name
sb:state-body)
#:binding [(export n) {(import sb)}])
#:binding [(export n) (scope (import sb))])

(host-interface/expression
(machine st:statechart-name)
Expand Down
30 changes: 15 additions & 15 deletions private/syntax/compile/binding-spec.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,18 @@
; convert surface syntax for a bspec to a structure representation.
(define elaborate-bspec
(syntax-parser
#:datum-literals (bind bind-syntax bind-syntaxes import export export-syntax export-syntaxes re-export nest nest-one host)
#:datum-literals (scope bind bind-syntax bind-syntaxes import export export-syntax export-syntaxes re-export nest nest-one host)
[v:nonref-id
(elaborate-ref (attribute v))]
[(bind v:nonref-id ...+)
[(bind ~! v:nonref-id ...+)
(group
(for/list ([v (attribute v)])
(bind
this-syntax
(elaborate-pvar v
(s* bindclass-rep)
"binding class"))))]
[(bind-syntax v:nonref-id v-transformer:nonref-id)
[(bind-syntax ~! v:nonref-id v-transformer:nonref-id)
(bind-syntax
this-syntax
(elaborate-pvar (attribute v)
Expand All @@ -135,7 +135,7 @@
(elaborate-pvar (attribute v-transformer)
(? stxclass-rep?)
"syntax class"))]
[(bind-syntaxes v:nonref-id v-transformer:nonref-id)
[(bind-syntaxes ~! v:nonref-id v-transformer:nonref-id)
(bind-syntaxes
this-syntax
(elaborate-pvar (attribute v)
Expand All @@ -144,29 +144,29 @@
(elaborate-pvar (attribute v-transformer)
(? stxclass-rep?)
"syntax class"))]
[(import v:nonref-id ...+)
[(import ~! v:nonref-id ...+)
(rec
this-syntax
(for/list ([v (attribute v)])
(elaborate-pvar v
(s* nonterm-rep [variant-info (s* exporting-nonterm-info)])
"exporting nonterminal")))]
[(re-export v:nonref-id ...+)
[(re-export ~! v:nonref-id ...+)
(re-export
this-syntax
(for/list ([v (attribute v)])
(elaborate-pvar v
(s* nonterm-rep [variant-info (s* exporting-nonterm-info)])
"exporting nonterminal")))]
[(export v:nonref-id ...+)
[(export ~! v:nonref-id ...+)
(group
(for/list ([v (attribute v)])
(export
this-syntax
(elaborate-pvar v
(s* bindclass-rep)
"binding class"))))]
[(export-syntax v:nonref-id v-transformer:nonref-id)
[(export-syntax ~! v:nonref-id v-transformer:nonref-id)
(export-syntax
this-syntax
(elaborate-pvar (attribute v)
Expand All @@ -175,7 +175,7 @@
(elaborate-pvar (attribute v-transformer)
(? stxclass-rep?)
"syntax class"))]
[(export-syntaxes v:nonref-id v-transformer:nonref-id)
[(export-syntaxes ~! v:nonref-id v-transformer:nonref-id)
(export-syntaxes
this-syntax
(elaborate-pvar (attribute v)
Expand All @@ -184,29 +184,29 @@
(elaborate-pvar (attribute v-transformer)
(? stxclass-rep?)
"syntax class"))]
[(nest v:nonref-id spec:bspec-term)
[(nest ~! v:nonref-id spec:bspec-term)
(nest
this-syntax
(elaborate-pvar (attribute v)
(s* nonterm-rep [variant-info (s* nesting-nonterm-info)])
"nesting nonterminal")
(elaborate-bspec (attribute spec)))]
[(nest-one v:nonref-id spec:bspec-term)
[(nest-one ~! v:nonref-id spec:bspec-term)
(nest-one
this-syntax
(elaborate-pvar (attribute v)
(s* nonterm-rep [variant-info (s* nesting-nonterm-info)])
"nesting nonterminal")
(elaborate-bspec (attribute spec)))]
[(host v:nonref-id)
[(host ~! v:nonref-id)
(suspend
this-syntax
(pvar (attribute v) (lookup-pvar (attribute v))))]
[(~braces spec ...)
[(scope ~! spec ...)
(scope
this-syntax
(group (map elaborate-bspec (attribute spec))))]
[(~brackets spec ...)
[(spec ...)
(group (map elaborate-bspec (attribute spec)))]))


Expand Down Expand Up @@ -310,7 +310,7 @@
; - (nest a [(bind x) x]) shouldn't be legal as we have
; no static guarantee about the length of a or whether its
; associated non-terminal installs any scopes.
; - {(nest a [(bind x) x)])} shouldn't be legal as it would imply binding
; - (scope (nest a [(bind x) x)])) shouldn't be legal as it would imply binding
; in a scope created by the nesting non-terminal, and the binding might
; come after a reference created in the nesting non-terminal.
; - Bindings should come before rec and references within a scope
Expand Down
8 changes: 4 additions & 4 deletions private/test/set-bang.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ set!-transformers.
(nonterminal mylet-expr
#:description "mylet expression"
(mylet v:var body:racket-expr)
#:binding {(bind v) body}
#:binding (scope (bind v) body)
(regular-let v:var val:racket-expr body:racket-expr)
#:binding {(bind v) body}
#:binding (scope (bind v) body)
(rep-let v:var body:racket-expr)
#:binding {(bind v) body}
#:binding (scope (bind v) body)
(mybegin def:mydef body:racket-expr)
#:binding {(import def) body})
#:binding (scope (import def) body))

(nonterminal/exporting mydef
#:description "mylet definition"
Expand Down
2 changes: 1 addition & 1 deletion scribblings/reference/specifying.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ defined in the space.
@racketgrammar[#:literals (bind import re-export export nest nest-one)
binding-spec spec-variable-id
(bind spec-variable-id ...+)
{spec ...}
(scope spec ...)
[spec ...]
(nest spec-variable-id binding-spec)
(nest-one spec-variable-id binding-spec)
Expand Down
6 changes: 3 additions & 3 deletions scribblings/tutorial.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ For now it's a stub.
(nonterminal event-spec
(on (evt:id) t:transition-spec)
(on (evt:id arg:local-var ...) #:when guard:guard-expr t:transition-spec)
#:binding {(bind arg) guard}))
#:binding (scope (bind arg) guard)))


@subsection{Definition contexts}
Expand All @@ -141,7 +141,7 @@ For now it's a stub.

@(racketblock
(machine #:initial inital-state:state-name s:state-spec ...)
#:binding {(import s) initial-state})
#:binding (scope (import s) initial-state))

@(racketblock
(nonterminal/exporting state-spec
Expand Down Expand Up @@ -169,7 +169,7 @@ For now it's a stub.
@(racketblock
(nesting-nonterminal binding-pair (nested)
[v:local-var e:guard-expr]
#:binding {(bind v) nested}))
#:binding (scope (bind v) nested)))

@section[#:tag "racket"]{Integrating Racket Subexpressions}

Expand Down
14 changes: 7 additions & 7 deletions tests/basic-langs/bind-syntax.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
n:number
((~literal +) e:racket-like-expr ...)
(racket-letrec-syntax ([v:racket-macro e:expr] ...) b:racket-like-expr)
#:binding {(bind-syntax v e) b}
#:binding (scope (bind-syntax v e) b)

(racket-letrec-syntaxes ([(v:racket-macro ...) e:expr] ...) b:racket-like-expr)
#:binding {(bind-syntaxes v e) b}
#:binding (scope (bind-syntaxes v e) b)
e:racket-expr)

(host-interface/expression
Expand Down Expand Up @@ -50,21 +50,21 @@
((~literal +) e:my-expr ...)

(my-let ([v:my-var e:my-expr] ...) b:my-expr)
#:binding {(bind v) b}
#:binding (scope (bind v) b)

(my-letrec-syntax ([v:my-macro e:expr] ...) b:my-expr)
#:binding {(bind-syntax v e) b}
#:binding (scope (bind-syntax v e) b)

(my-letrec-syntaxes ([(v:my-macro ...) e:expr] ...) b:my-expr)
#:binding {(bind-syntaxes v e) b}
#:binding (scope (bind-syntaxes v e) b)

; this binds racket-macros, which cannot be used in my-exprs
; uses of bound macros should error.
(bad-my-letrec-syntax ([v:racket-macro e:expr] ...) b:my-expr)
#:binding {(bind-syntax v e) b}
#:binding (scope (bind-syntax v e) b)

(bad-my-letrec-syntaxes ([(v:racket-macro ...) e:expr] ...) b:my-expr)
#:binding {(bind-syntaxes v e) b})
#:binding (scope (bind-syntaxes v e) b))

(host-interface/expression
(my-lang e:my-expr)
Expand Down
2 changes: 1 addition & 1 deletion tests/basic-langs/block.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

(host-interface/expression
(block body:block-form ...)
#:binding {(import body)}
#:binding (scope (import body))
#'(compile-block body ...)))

(define-syntax compile-block
Expand Down
2 changes: 1 addition & 1 deletion tests/basic-langs/define-star.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#:binding (nest d tail)

(define*-values (v:var ...) e:expr)
#:binding [e {(bind v) tail}]
#:binding [e (scope (bind v) tail)]

e:expr))

Expand Down

0 comments on commit bac8674

Please sign in to comment.