     [ parser>> (transform) ]
     [ code>> insert-escapes ]
     [ parser>> ] tri build-locals
+    ! Add words we need for build-locals, then remove them
+    ! so we don't pollute the manifest qualified-vocabs
+    ! and also so restarts don't add multiple times
     qualified-vocabs length
+    "locals" { "[let" ":>" } add-words-from
+    "kernel" { "dup" "nip" "over" } add-words-from
+    "sequences" { "nth" } add-words-from
     [ string-lines parse-lines ] dip
-    qualified-vocabs set-length ;
+    dup 3 + qualified-vocabs delete-slice ;
 
 M: ebnf-action (transform) ( ast -- parser )
     ebnf-transform check-action-effect action ;

effects kernel make math.parser multiline namespaces parser peg
peg.parsers quotations sequences sequences.deep splitting
stack-checker strings strings.parser summary unicode.categories
words ;
FROM: vocabs.parser => search ;
FROM: peg.search => replace ;
IN: peg.ebnf


M: ebnf-var build-locals ( code ast -- code )
    [
        "[let dup :> " % name>> %
        " " %
        %
        " nip ]" %
