[futurebasic] RE: [FB] unary operations in expression

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2007 : Group Archive : Group : All Groups

From: "Edwards, Waverly" <Waverly.Edwards@...>
Date: Tue, 10 Apr 2007 16:34:25 -0400
Thank you very much,


W. 

-----Original Message-----
From: Robert Purves [mailto:listrp@...] 
Sent: Friday, April 06, 2007 11:25 PM
To: futurebasic@...
Subject: Re: [FB] unary operations in expression


Edwards, Waverly wrote:

> I wrote a recursive descent expression evaluator that mimics FB's 
> evaluation. In writing it I found FB's unary operation to be right 
> associative.  Anyone have an idea of how you might parse an expression

> where the unary operation, the operation just below a primitive factor

> would be implemented right associatively?


>
> Understanding how this phase of parsing works, I don't see how its 
> possible for unary operations to be right associative before going 
> onto factor.
>
> My only idea would be to recursively call fn level1 after encountering

> a unary operation.  That doesn't seem like that great an idea.

See Expression Evaluator Folder in Examples on the FB CD.
Here's an extract showing how unary + or - are handled in the parsing
function Factor. The recursive call to Factor means that the operator is
applied to the immediately following factor.

[snip]