POV-Ray : Newsgroups : povray.off-topic : A silly little toy (~200 kb) : Re: A silly little toy (~200 kb) Server Time
10 Oct 2024 03:16:05 EDT (-0400)
  Re: A silly little toy (~200 kb)  
From: Orchid XP v8
Date: 15 Oct 2008 16:43:42
Message: <48f655fe@news.povray.org>
Darren New wrote:
> Orchid XP v8 wrote:
>> Oh, OK. It's actually all very readable on my screen; I guess it has a 
>> higher gamma or something.
> 
> I actually live where it's sunny during the daytime. ;-)
> 
> I have trouble with a lot of video games, too.

Ah, OK. My office at work [where I coded this program] has no sunlight. 
I don't even know if it's day or night or whatever. A bit like caving, 
actually... random...

As for my bedroom at home... I just close the curtains when I want to 
play HL2. ;-)

>> BTW, are you impressed that I got this to work? Somebody wrote a small 
>> Haskell library that invokes windows.h under Windoze or emits ANSI 
>> escape sequences on POSIX. Neat, eh? Also, notice the window title 
>> bar... ;-)
> 
> Yep. I'm impressed. :-)

Heh. Actually I wrote a small library of my own that calls windows.h 
directly. [You've seen the code, haven't you?] But somebody else came up 
with a nice library that works on Windoze *and* POSIX, so now I'm using 
that instead. So I really could compile my program for Linux or 
something if I want.

>> Since "+" isn't a valid token, 
> 
> Ah.
> 
>> This is one of the irritating things about Parsec. It can silently 
>> fail to parse all of the input. Like, if some prefix of the input is a 
>> valid expression but the rest isn't, it returns just the prefix. 
>> (Obviously it depends how you structure your parser.) I must figure 
>> out how to fix that...
> 
> Doesn't it also return the rest of the unparsed string? So if that isn't 
> empty, something failed?

Nope.

Remember, each "parser" can be combined with other parsers to make a 
larger parser at any time. And it might be that the parser is only 
*trying* to parse some prefix of the input.

I just asked about it, and some people recommended adding the "eof" 
parser to the top-level parser. (This causes the parser to fail if the 
entire input is not parsed. The error message is likely to be pretty 
opaque though...)

BTW, have you tried making the parser deliberately fail? It doesn't just 
crash the program, it actually reports a (moderately) friendly message 
to the user. It even hilights where in your input it's upset - in case 
you can't mentally work out where "column 28" is. Neat, eh? ;-)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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