You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scribblings/reference/compiling.scrbl
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@
8
8
@title{Compiling languages}
9
9
10
10
@section[#:tag"reference compilers"]{Compiling references to DSL bindings within Racket code}
11
+
@tex-label{doc:referencecompilers}
11
12
12
13
@margin-note{@secref["compilation"#:doc '(lib"syntax-spec-dev/scribblings/main.scrbl")] in the @secref["Basic_Tutorial__State_Machine_Language"
13
14
#:doc '(lib"syntax-spec-dev/scribblings/main.scrbl")] introduces the use of reference compilers.}
@@ -74,6 +75,7 @@ Another concept that comes up when discussing identifiers and compilation is pos
74
75
During the expansion of the invocation, when a macro's transformer is running, the macro transformer will see this introduction scope on the incoming syntax. This syntax is in @deftech{negative space}. After the scope is flipped off on the result, the syntax is in @deftech{positive space}. It's important to note that positive vs negative space depends on the @emph{current} introduction scope, as there may be many introduction scopes floating around. It is also possible to manually flip this scope in a transformer to convert syntax between positive and negative space.
75
76
76
77
@section{Symbol collections}
78
+
@tex-label{doc:symboltables}
77
79
78
80
Symbol collections allow compilers to track information related to dsl variables. Symbol collections expect to receive @tech{compiled identifiers} in @tech{negative space}.
@@ -78,7 +78,7 @@ to use for all extensions with this class.
78
78
79
79
@section{Nonterminals}
80
80
81
-
@defsubform[(nonterminal id nonterminal-option production ...)]
81
+
@defform[(nonterminal id nonterminal-option production ...)]
82
82
83
83
Defines a nonterminal supporting @racket[let]-like binding structure.
84
84
@@ -96,7 +96,7 @@ Example:
96
96
97
97
@let-example
98
98
99
-
@defsubform[(nonterminal/nesting id (nested-id) nonterminal-option production ...)]
99
+
@defform[(nonterminal/nesting id (nested-id) nonterminal-option production ...)]
100
100
101
101
Defines a @deftech{nesting nonterminal} supporting nested, @racket[let*]-like binding structure. Nesting nonterminals may also be used to describe complex binding structures like for @racket[match].
102
102
@@ -117,7 +117,7 @@ Example:
117
117
]]
118
118
@let*-example
119
119
120
-
@defsubform[(nonterminal/exporting id nonterminal-option production ...)]
120
+
@defform[(nonterminal/exporting id nonterminal-option production ...)]
121
121
122
122
Defines an @deftech{exporting nonterminal} which can export bindings, like @racket[define] and @racket[begin].
123
123
@@ -252,6 +252,7 @@ When a form production's form is used outside of the context of a syntax-spec DS
@@ -448,7 +449,7 @@ There are several other constraints on binding specs:
448
449
Host interface forms are the entry point to the DSL from the host language. They often invoke a compiler macro to translate
449
450
the DSL forms into Racket expressions.
450
451
451
-
@defsubform[(host-interface/expression
452
+
@defform[(host-interface/expression
452
453
(id . syntax-spec)
453
454
maybe-binding-spec
454
455
pattern-directive ...
@@ -476,7 +477,7 @@ An example from the @hyperlink["https://github.com/michaelballantyne/syntax-spec
476
477
This defines @racket[run], which takes in a Racket expression representing a number, a term variable, and a goal, and invokes
477
478
the compiler @racket[compile-goal] to translate the DSL forms into Racket.
478
479
479
-
@defsubform[#:literals (->define)
480
+
@defform[#:literals (->define)
480
481
(host-interface/definition
481
482
(id . syntax-spec)
482
483
maybe-binding-spec
@@ -522,7 +523,7 @@ An example from the @hyperlink["https://github.com/michaelballantyne/syntax-spec
522
523
523
524
This defines @racket[defrel], which defines a relation. In the @racket[#:lhs], We record arity information about the identifier before producing it. Since the left-hand-sides all run before the right-hand-sides, even if there is mutual recursion, all arity information will be available before any goals are compiled. Note that the @racket[#:rhs] produces a lambda expression, not a @racket[define].
0 commit comments