 
 reset-pegs 
 
+#! An entry in the table of memoized parse results
+#! ast = an AST produced from the parse
+#!       or the symbol 'fail'
+#!       or a left-recursion object
+#! pos = the position in the input string of this entry
 TUPLE: memo-entry ans pos ;
-C: <memo-entry> memo-entry
-
-TUPLE: left-recursion seed rule head next ;
-C: <left-recursion> left-recursion
- 
+
+TUPLE: left-recursion seed rule head next ; 
 TUPLE: peg-head rule involved-set eval-set ;
-C: <head> peg-head
-
-: rule-parser ( rule -- parser ) 
+
+: rule-id ( word -- id ) 
   #! A rule is the parser compiled down to a word. It has
-  #! a "peg" property containing the original parser.
-  "peg" word-prop ;
+  #! a "peg-id" property containing the id of the original parser.
+  "peg-id" word-prop ;
 
 : input-slice ( -- slice )
   #! Return a slice of the input from the current parse position


:: setup-lr ( r l -- )
  l head>> [
    r V{ } clone V{ } clone <head> l (>>head)
  ] unless
  r l lrstack get (setup-lr) ;


  #! Return the index from the original string that the
  #! input slice is based on.
  dup slice? [ slice-from ] [ drop 0 ] if ;

: process-rule-result ( p result -- result )
  [
