On 11/27/10 10:17 AM, Orlando Hill wrote:
Hi Andrew,

I don't understand why 'begin' is being used in the definition of
'alt'. I would expect that to mean, only the result of the second
alternative will be returned.

Well, I'm not too sure about much in the CPS version. For example, "terminal" doesn't actually return a '() in the original paper on a non-match for the CPS version, yet it does for the original version.

So, I'm kind of groping around for what the "meaning" of certain operations is. There have been a couple of typos in code in the paper, so I have to watch giving too much emphasis to the code without thinking about it and understanding it.

Here is a definition of 'alt' that works for your example.

(define (alt alt1 alt2)
   (lambda (continuation pos)
     (alt1 (lambda (pos1)
             (if (null? pos1)
                 (alt2 continuation pos)
                 (continuation pos1)))
           pos)))

Thanks.

-a

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to