![]() |
Unexpected end of file error - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16) +---- Thread: Unexpected end of file error (/showthread.php?tid=365) |
Unexpected end of file error - oblo - 07-31-2011 Hi all Sorry to bother you twice in the same day :? I'm falling back to the safe land of BASIC but I'm still struggling with problems. I'm getting an "Unexpected end of file. Compilation failed" error. I'm searching for a lost bracket, lost END IF or similar (another post suggests that could be a lost parenthesis but I can't find any). What others symbols/codes/etc must I look for? I'm compiling with tha last version and with the following options: zxb.exe oc_UTF8.bor -S 27000 -t -B -a -o oc_UTF8.tap -O 0 --heap-size=1024 Thanks and regards Re: Unexpected end of file error - boriel - 07-31-2011 Remember you can attach this file in a *private* message if you don't want to disclose your source code to the other (e.g. a game surprise!) :wink: Re: Unexpected end of file error - oblo - 07-31-2011 Thanks, but I have no problem with share the code (well, at least for this) :wink: Nevertheless, I've just found four END IF that were lost. Nothing is better that to post to find the question by yourself ![]() Cheers Re: Unexpected end of file error - boriel - 07-31-2011 The problem is on lines 1790..1820: These lines have two *nested* if (one if inside another one). So a 2nd END IF is needed at the end of every line. That is, there are two ifs in those lines, so close them with END IF: END IF. Code: 1790 IF dp = 4 AND c(ox+1, oy)>0 AND c(ox+1, oy)<10 THEN LET dpf=dpf+1: IF dpf=8 THEN LET fpf = 0: LET oy=oy -1: END IF: END IF Code: 1790 IF dp = 4 AND c(ox+1, oy)>0 AND c(ox+1, oy)<10 THEN Re: Unexpected end of file error - oblo - 07-31-2011 Yep, thanks, those were the 'rogues' END IFs. Nevertheless, the obtained code doesn't work (all I can get is a blank screen and no more) but I can assure you the BASIC code works (extremely slow but works) Using the Spectaculator debugger I can see that all the instructions are being executed... great, more Sunday code debug :lol: Cheers Re: Unexpected end of file error - boriel - 07-31-2011 oblo Wrote:Yep, thanks, those were the 'rogues' END IFs. Nevertheless, the obtained code doesn't work (all I can get is a blank screen and no more) but I can assure you the BASIC code works (extremely slow but works) Using the Spectaculator debugger I can see that all the instructions are being executed... great, more Sunday code debug :lol:Hmm, your'e POKEin directly into the UDG zone :?: Try using USR "a" + xxx to poke "A" UDG, and so on (as explained in the manual). Or use PEEK (Uinteger, 23675), as ZX BASIC might need to reallocate UDG mem zone. I will later tell you a trick to create UDG in a faster/efficient way ![]() Re: Unexpected end of file error - oblo - 07-31-2011 Thanks, that will be apprecciated ![]() Cheers EDIT: vars, vars, vars... all the vars need the EXACT kind of var it will be. Also, I've found that mark a var as uInteger and make it through the last number (65535) in a FOT statement, it bakcs again to be 1! So, the FOR statament never ends because when it reach its last value, it goes back again to 1 before the NEXT instruction. Maybe I'm missing something? :? Re: Unexpected end of file error - boriel - 07-31-2011 No, you are RIGHT!! The construction is FOR <var> = <lower> TO <upper> STEP <step>. The <var> needs to reach a value GREATER than <upper>. Uinteger won't ever be larger than 65535 (due to overflow). Better use DO ... UNTIL <var> == <limit>. You can also use ULong type (DIM f As ULong somewhere before f is being used for the first time). This has been discused here: <!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/bug-reports/topic423.html">bug-reports/topic423.html</a><!-- l --> |