 : check-optional ( result -- result )
   [ input-slice f <parse-result> ] unless* ;
 
-M: optional-parser (compile) ( parser -- quot )
+M: optional-parser (compile) ( peg -- quot )
   p1>> compiled-parser 1quotation '[ @ check-optional ] ;
 
 TUPLE: semantic-parser p1 quot ;

: parser-body ( parser -- quot )
  #! Return the body of the word that is the compiled version
  #! of the parser.
  gensym 2dup swap (compile) 0 1 <effect> define-declared swap dupd "peg" set-word-prop
  [ execute-parser ] curry ;

: compiled-parser ( parser -- word )

    drop
  ] if ; inline

M: action-parser (compile) ( peg -- quot )
  [ p1>> compiled-parser 1quotation ] [ quot>> ] bi '[ @ , check-action ] ;

: left-trim-slice ( string -- string )
