BBC BASIC for Windows
« Syntax Error in a compiled executable »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:59pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Syntax Error in a compiled executable  (Read 1062 times)
JFS
New Member
Image


member is offline

Avatar




PM


Posts: 11
xx Syntax Error in a compiled executable
« Thread started on: Jan 16th, 2015, 3:10pm »

My programme produces a "Syntax Error" when I run it as a compiled executable with the "Abreviate Names" option selected but not if it is compiled without this option, or run from the IDE. If I number the lines, the line number reported by the Error Message points to a DIM statement which has been unchanged in the code for donkey's years. This came as a complete shock given that I have been compiling this and similar programmes for years without ever having experienced problems before. And I can't think what might be different this time round. Although it has been a few weeks since I compiled this code, I have compiled other versions over the last few days without any problems.

Just by way of a shot in the dark, I tried REM! Keep ing the array in the offending DIM statement but without effect.

As it is a very large programme, I would appreciate any guidance as to where to start looking.

Many thanks,

Howard

User IP Logged

Best Wishes,

Howard
rtr2
Guest
xx Re: Syntax Error in a compiled executable
« Reply #1 on: Jan 16th, 2015, 3:37pm »

on Jan 16th, 2015, 3:10pm, JFS wrote:
As it is a very large programme, I would appreciate any guidance as to where to start looking.

Are you by any chance using the new REM!Fast compiler directive available in v6.00a? The symptom you describe is exactly what happens if you inadvertently specify a structure member in such a directive, contrary to the documentation.

If that's not the explanation, compile your program with 'Encrypt and compress' not checked and send it to me (preferably zipped) as an attachment to a private email.

Richard.
User IP Logged

JFS
New Member
Image


member is offline

Avatar




PM


Posts: 11
xx Re: Syntax Error in a compiled executable
« Reply #2 on: Jan 16th, 2015, 4:20pm »

Many thanks for this Richard. I have compiled a version with all the embedded files stripped out which makes it less than 200kB and sent that to you. As it is an exe it may get trapped by the thought police so please let me know if it does not get through.

Many thanks again,

User IP Logged

Best Wishes,

Howard
rtr2
Guest
xx Re: Syntax Error in a compiled executable
« Reply #3 on: Jan 16th, 2015, 5:13pm »

on Jan 16th, 2015, 4:20pm, JFS wrote:
As it is an exe it may get trapped by the thought police so please let me know if it does not get through.

It survived the journey! Currently I am as puzzled as you are, but I have requested further information from you by email to assist with the diagnosis. I await your response.

Richard.
User IP Logged

rtr2
Guest
xx Re: Syntax Error in a compiled executable
« Reply #4 on: Jan 16th, 2015, 11:07pm »

It turns out that the problem was caused by 'dead code', that is code which is never executed when the program is run in the IDE, but the presence of which can upset the 'compiler' and cause the executable to fail.

Often dead code won't be an issue, other than to increase the size of the executable unnecessarily, but if certain kinds of syntax error are present in that code it may confuse the compiler and impact on the operation of the rest of the program. So it was in this case.

Although it isn't a complete remedy, I would strongly recommend that the Cross Reference Utility be run, and any warnings it may give be examined, before any program is compiled. It's entirely likely that the warnings will turn out to be of no importance - that is why they are only warnings - but they may draw attention to a fault or weakness in the code you weren't aware of.

Richard.
User IP Logged

JFS
New Member
Image


member is offline

Avatar




PM


Posts: 11
xx Re: Syntax Error in a compiled executable
« Reply #5 on: Jan 17th, 2015, 07:38am »

Richard,

Many thanks for your kind assistance in sorting this one out. Just a question on structure members and the REM!Fast compiler directive. Could you confirm or correct my understanding please, which is that this would all be acceptable:-

Member% +=0
MEMBER% +=0
DIM Structure{Member%,MEMBER%}
DIM StructArray{(10) Member%,MEMBER%}
...
REM!Fast Structure{}, StructArray{()}, Member%

...but the addition of this line:-

REM!Fast Structure.Member%

.. would break things

Many thanks,
« Last Edit: Jan 17th, 2015, 07:41am by JFS » User IP Logged

Best Wishes,

Howard
rtr2
Guest
xx Re: Syntax Error in a compiled executable
« Reply #6 on: Jan 17th, 2015, 09:27am »

on Jan 17th, 2015, 07:38am, JFS wrote:
REM!Fast Structure{}, StructArray{()}, Member%

It's OK to have Structure{} and StructArray{()} in a REM!Fast directive, but adding Member% will cause the program to fail at run-time with a Syntax Error (it's the name of a structure member).

This is called out in the documentation: "You must not include in the list the names of any structure members (even if they happen to share their name with a normal variable)".

Quote:
REM!Fast Structure.Member%

That is invalid syntax; I don't know exactly what would happen if you tried it but it won't be helpful! The docs state that REM!Fast "accepts a list of variable, array, structure, function and procedure names", and what you have there is none of those.

The REM!Fast directive should only be used if it provides a real benefit, and only after your program has been thoroughly debugged. Its incorporation makes the compiled code 'unreadable' and would have made the diagnostics I performed yesterday, to trace the cause of your problem, impossible to carry out.

Richard.
User IP Logged

JFS
New Member
Image


member is offline

Avatar




PM


Posts: 11
xx Re: Syntax Error in a compiled executable
« Reply #7 on: Jan 17th, 2015, 12:52pm »

That's fine - many thanks for the clarification Richard.
User IP Logged

Best Wishes,

Howard
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls