POV-Ray : Newsgroups : povray.off-topic : Very long post : Re: Very long post Server Time
7 Sep 2024 07:26:10 EDT (-0400)
  Re: Very long post  
From: Darren New
Date: 25 Sep 2008 17:32:34
Message: <48dc0372$1@news.povray.org>
scott wrote:
>> Typically, it's done with regular expressions. And typically, "-37" is 
>> two tokens in programming language compilers, at least.
> 
> 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?

Typically, it's one token. You can't tell (in a language like Pascal) as 
you're parsing tokens. You have to get to the syntax tree before 
figuring out whether it's a unary or binary minus.

In APL, there are two minus signs, one for the operator and one you put 
in front of negative numbers. Which helps more than you'd think because 
all operators are right-associative.

-- 
Darren New / San Diego, CA, USA (PST)


Post a reply to this message

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