POV-Ray : Newsgroups : povray.off-topic : Very long post : Re: Very long post Server Time
7 Sep 2024 05:08:51 EDT (-0400)
  Re: Very long post  
From: scott
Date: 25 Sep 2008 06:09:17
Message: <48db634d@news.povray.org>
>> OK, and then is there only one token for "minus", or are there two for 
>> unary and binary minus?  ie does the parser decide or the tokeniser?
>
> Varies depending on the rules of whatever you're trying to process, but 
> typically it's the parser.

I'm just curious, because I made a parser like this in C++ once (it was very 
hacky and basically just stepped along the string trying to identify what 
each byte was).  Anyway, it worked ok for things like "-5*(4+2)" etc, but 
crashed with "-(4+2)".  I guess the minus operator should be encoded as its 
own token and then let the parser sort out what it should do.  Maybe I'll 
try a rewrite one day.


Post a reply to this message

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