Skip to content

Commit

Permalink
little tutorial fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelballantyne committed Feb 16, 2025
1 parent 96abac4 commit 091b18b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scribblings/tutorial/basic-tutorial.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ Now let's add binding rules for state names. We can't just use @racket[scope] an
(on (event-name:id arg:event-var ...)
action:action-spec
...
((~datum goto) next-state:state-name))))
((~datum goto) next-state:state-name))
#:binding (scope (bind arg) ... action ...)))

We use an exporting nonterminal for @racket[state-spec], which allows us to use the @racket[export] binding rule. This binds @racket[name] in @racket[transition] and the other @racket[state-spec] forms in the body of the machine, like @racket[define] in a @racket[class] body or a @racket[block] form.

Expand Down Expand Up @@ -372,6 +373,8 @@ Now Let's start to write the compiler:
#'(compile-machine initial-state s ...))
...)

(require (for-syntax syntax/parse racket/list))

(define-syntax compile-machine
(syntax-parser
#:datum-literals (machine state on-enter)
Expand Down

0 comments on commit 091b18b

Please sign in to comment.