POV-Ray : Newsgroups : povray.off-topic : Mini-languages : Re: Mini-languages Server Time
4 Sep 2024 01:21:58 EDT (-0400)
  Re: Mini-languages  
From: Invisible
Date: 11 Nov 2010 04:19:04
Message: <4cdbb508$1@news.povray.org>
>> xs <- many1 digit
>> if length xs > 3 then fail else return ()
>
> By the way, this also means you have backtracking

No it doesn't.

Parsec doesn't backtrack by default; you have to explicitly request it 
(which I haven't).

If there are more than three digits, the above parser fails, and no 
other alternatives are tried (i.e., no backtracking).

(As an aside, there are other Haskell libraries that work similarly to 
Parsec, but where backtracking is the default and turning it off is 
explicit. Apparently this is more intuitive to work with...)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.