It is currently Fri May 26, 2017 7:24 pm



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Line numbers in error messages
Unread postPosted: Tue Nov 29, 2016 6:21 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5518
Location: Paris, France
@Luca: first it would be very heavy to have all these labels ;)
Second it simply will not work: the preprocessor splits the commands seperated by colons!
Do the test:
Code:
test1::?1/0
will display
BASIC! wrote:
DIVIDE BY ZERO AT:
?1/0

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Report this post
Top
 Profile  
 
 Post subject: Re: Line numbers in error messages
Unread postPosted: Tue Nov 29, 2016 8:03 am 
Offline

Joined: Wed Feb 20, 2013 3:25 pm
Posts: 423
Location: Italy
Yes you are right.

Luca


Report this post
Top
 Profile  
 
 Post subject: Re: Line numbers in error messages
Unread postPosted: Fri Dec 02, 2016 1:00 pm 
Offline

Joined: Tue Dec 04, 2012 10:50 am
Posts: 656
Location: UK
mjcoon wrote:
As soon as I had gone to bed I realised that since the interpreter is reading the intermediate file randomly (by following the program logic; so not serially, I mean!) every line in the file would have to be tagged with its file name and line number, just in case a fault report was needed. (Although some post-fault scanning could reconstruct the same information instead.) A bit of an overhead in the pre-processor and the file would be a bit bigger. Could still be worth it, though, perhaps as a debugging option...

Mike.

Another improvement: the preprocessor could construct an index of the constituent files and where they start and finish in terms of the merged line numbers. Then any fault can be referred back to the original line number. I think this would need the minimum of alterations, so long as there is a way of passing the "index".

Mike.


Report this post
Top
 Profile  
 
 Post subject: Re: Line numbers in error messages
Unread postPosted: Sat Dec 03, 2016 2:44 am 
Offline

Joined: Tue Dec 04, 2012 10:50 am
Posts: 656
Location: UK
mjcoon wrote:
Another improvement: the preprocessor could construct an index of the constituent files and where they start and finish in terms of the merged line numbers. Then any fault can be referred back to the original line number. I think this would need the minimum of alterations, so long as there is a way of passing the "index".

Mike.

Yet another little thought (sorry about the baby steps; must be 2nd childhood!)...

Does the pre-processor remove block comment to speed up interpretation? If so, that is another mapping table that would be needed to convert merged-file line numbers to constituent file line numbers!

Mike.


Report this post
Top
 Profile  
 
 Post subject: Re: Line numbers in error messages
Unread postPosted: Sat Dec 03, 2016 2:55 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5518
Location: Paris, France
mjcoon wrote:
Does the pre-processor remove block comment to speed up interpretation?

Answer is yes.
You can read all what the preprocessor does in GitHub > src/com/rfo/basic/AddProgramLine.java

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Report this post
Top
 Profile  
 
 Post subject: Re: Line numbers in error messages
Unread postPosted: Sat Dec 03, 2016 9:36 am 
Offline
User avatar

Joined: Wed Jul 10, 2013 8:11 am
Posts: 327
luca_italy wrote:
It would be very easy to create a small BASIC! script which takes a .bas as input and creates a debug version for it:

test.bas -> test_debug.bas


Luca, maybe you are on the rigth track.

After an error you get a colored line in the editor with the affected TheIncludedLib.bas.
At this point you merge test.bas and source from TheIncludedLib.bas to test_debug.bas.

You do not get the line number but the affected line.

Happy coding
Gregor


Report this post
Top
 Profile  
 
 Post subject: Re: Line numbers in error messages
Unread postPosted: Sun Dec 04, 2016 3:53 pm 
Offline

Joined: Tue Dec 04, 2012 10:50 am
Posts: 656
Location: UK
mougino wrote:
You can read all what the preprocessor does in GitHub > src/com/rfo/basic/AddProgramLine.java

Thanks for that nudge Nicolas.

I tried reading that file despite my lack of familiarity with Java.

For instance I would have thought that there would be no point in two successive assignments as here:
Code:
         String stmt = parts[0];
         stmt = "endif\n";                     // complete it now


Or am I missing something?

That bit of code is commented (thank goodness for lots of comments!) that it adds ENDIF to IF statements of the short form. This makes me wonder if new-lines get added as well as removed by pre-processing, making the mapping of line numbers more complex still.

Similarly with removal of line-continuation characters "~".

Mike.


Report this post
Top
 Profile  
 
 Post subject: Re: Line numbers in error messages
Unread postPosted: Mon Dec 05, 2016 1:06 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5518
Location: Paris, France
Yes the preprocessor can do that. Typically it will change this
Code:
IF test THEN i=0 : GOTO label
to that
Code:
IF test THEN
  i=0
  GOTO label
END IF

On the opposite with "~" it will fuse different lines into a single one.

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Report this post
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
suspicion-preferred