Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Back-End build process error: expected expression before ';'

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
pjc30943



Joined: 02 Dec 2005
Posts: 220

Posted: 21 August 2009, 2:08 AM    Post subject: Back-End build process error: expected expression before ';' Reply with quote

When y2 = y1, obviously slope = INF. A backend build error arises as a result.
The following is a generic function which demonstrates the problem. Both of the last two lines of the function are required for the error to arise. Additionally, the numerator of 'm' is necessary; if m is instead
1.0 / ( y2 - y1 ), the error does not arise.
The device is a 1280n.

Code:
function A ( byval D as single ) as single
            const C as single = 20.0
            const x2 as single = 20.0, x1 as single = 10.0
   const y2 as single = 1.0, y1 as single = 1.0
   const m as single = ( x2 - x1 ) / ( y2 - y1 )
   const b as single = y2 - (m*y1)
   A = m * abs(D) + b      
   A = A * C
end function


Code:
biped_joint_controllers_2legs.c:25: error: expected expression before ';' token
make: *** [biped_joint_controllers_2legs.o] Error 1
make: Leaving directory `C:/Program Files/ZBasic/zx_rEudRJ'
biped joint controllers 2legs.bas:21: Internal Error: no means to generate code for expression
Back to top
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 21 August 2009, 16:46 PM    Post subject: Re: Back-End build process error: expected expression before Reply with quote

This problem actually occurs in the front-end ZBasic compiler which is attempting to calculate the constant expression which evaluates to +INF. This is a problem that should be fixed. The compiler should probably issue warnings for constant expressions that evaluate to -/+INF and NAN.

My question is why do you have a constant expression that is +INF? Any special case calculations involving INF and NAN are probably not supported by ZBasic as they require a lot of special case logic for different expressions.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 21 August 2009, 17:26 PM    Post subject: Re: Back-End build process error: expected expression before Reply with quote

mikep wrote:
The compiler should probably issue warnings for constant expressions that evaluate to -/+INF and NAN.
Quite so. I just finished adding that and modified the native mode code generator to emit a valid value (0.0) when a NaN, infinity or denormalized value is encountered. Of course, this doesn't make the code work but it does avoid the backend compiler errors.
Back to top
pjc30943



Joined: 02 Dec 2005
Posts: 220

Posted: 21 August 2009, 21:26 PM    Post subject: Reply with quote

The INF was an inadvertant result when accidentally setting both values to be identical. The error was not well defined, hence the post...
The error occurred not when just evaluating the constant expression, given that a few cases (such as 1.0 / (n-n) = 1.0 / 0.0 ) compiled.

Hence my assumption that this was a compiler bug, versus a front-end evaluation error.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group