   } cond ;
  
 M: ebnf-action (transform) ( ast -- parser )
-  [ parser>> (transform) ] [ code>> ] [ parser>> ] tri build-locals 
+  [ parser>> (transform) ] [ code>> ] [ parser>> ] tri build-locals  
   string-lines parse-lines check-action-effect action ;
 
 M: ebnf-semantic (transform) ( ast -- parser )

GENERIC: build-locals ( code ast -- code )

M: ebnf-sequence build-locals ( code ast -- code )
  elements>> dup [ ebnf-var? ] filter empty? [
    drop 
  ] [ 
    [
      "USING: locals sequences ;  [let* | " %
        dup length swap [
          dup ebnf-var? [
            name>> % 
            " [ " % # " over nth ] " %
          ] [
            2drop
          ] if
        ] 2each
        " | " %
        %  
        " nip ]" %     
    ] "" make 
  ] if ;

M: ebnf-var build-locals ( code ast -- )

  ] choice* ;
  
: 'choice' ( -- parser )
  'actioned-sequence' sp repeat1 [ dup length 1 = [ first ] [ <ebnf-sequence> ] if  ] action "|" token sp list-of [ 
    dup length 1 = [ first ] [ <ebnf-choice> ] if
  ] action ;
 
