BasEdit.NET

You need an actual VIC.

Moderator: Moderators

User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

OK, It now passes the syntax check without crashes, still remain some "false" syntax error results that I will report you.

I will find a bit of time during the week-end, here in Italy is very hot, it's time for the beach along with my children... btw the night is very looong :wink:
Mega-Cart: the cartridge you plug in once and for all.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

OK, very log test season !!!

checked about 150 listing :shock:

I've found a "compilation" problem on this row:

Code: Select all

3220 DATAUNA,CHIAVE,18,DEI,TOPI,21,DELL',AGLIO,27,UNA,SCALA,14,UNA,BOTTIGLIA,0
When compiled the word "DELL" is on the end of the row.

maybe there is an OS incompatibility, do you use a MAC ? :lol:

I've also the full list of "false" syntax error check, you have PM :wink:
Mega-Cart: the cartridge you plug in once and for all.
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Oh, no, that's because the single apostrophe (') can be used as a REM, too.
But it should only take effect if a) you are using the project mode or b) the TokenFile has a line with "HasSimpleRem=1" to enable this sort of comment!

I will check if I can see what happened...
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

I had a first look at nbla000's impressive list of "syntax check errors" and detected something I never thought of:

There are some usages of relational operators in "the wrong order":

Code: Select all

10 ifa$><"s"then...
instead of

Code: Select all

10 ifa$<>"s"then...
I always thought that only the <>, <= and >= where allowed, not ><, => or =<. Maybe I'm a little bit biased by Pascal or some other languages...
Anyways, it shouldn't be to difficult to accept the other combinations, but then I detected another anomaly:

Code: Select all

61 ifa$<>="s"thenpokeva,0:tt=tt+1:iftt=500then4
may be syntactically ok for Basic V2 but as my tests show the part behind "if a$<>="s"then" will be executed regardless of the variable a$!

Code: Select all

10a$="s"
20ifa$<>="s"thenprint"behind then!"
It doesn't matter what you put into a$, you will always get the message "behind then" printed. Therefore I would like to specify the following allowed combinations of relative operatores:

=
<
>
<= / =<
>= / =>
<> / ><

So at most it could have 2 relational operators! Did I miss anything about these relational operators which is used and valid and makes sense?
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

Schlowski wrote:So at most it could have 2 relational operators! Did I miss anything about these relational operators which is used and valid and makes sense?
It seems ok to me.
Mega-Cart: the cartridge you plug in once and for all.
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

After some more thoughts I think Basic V2 simply has 3 comparison flags for <, = and > and simply checks if these operators are present. Afterwards the values left and right of these operators will be compared and then Basic will evaluate if the comparison result matches with one of the available flags.
So if you have all three operators in your expression, it will check the result against "is less" OR "is equal" OR "is greater". Since any comparison has to match one of these results the <>= operation will always result in TRUE.
Another time I learned something new about the Interpreter!

So I will change the check as follows: Check for a single(!) occurance of <, = and > regardless of order. This way it's compatible to the Interpreter and does report a syntax error for constructs like >>=.
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

New version 1.42 uploaded:
- lots of bugfixes for syntax check
- tokenization bug fixed (FORI=CSTOCS now works as expected)
- better handling of ' comment in tokenization and code generation

@nbla000: all of your 88 samples now pass the syntax check :-)

I made some changes to the behaviour of the ' comment, so it now does not mark parts of the source as comment if you are not in label mode or the basic token file hasn't "HasSimpleRem=1".
But there still is the error that when converting from label to line# mode everything after the ' will be truncated if it's not in quotes.
So for your example

Code: Select all

3220 DATAUNA,CHIAVE,18,DEI,TOPI,21,DELL',AGLIO,27,UNA,SCALA,14,UNA,BOTTIGLIA,0 
you must enclose the offending data in quotes:

Code: Select all

3220 DATAUNA,CHIAVE,18,DEI,TOPI,21,"DELL'",AGLIO,27,UNA,SCALA,14,UNA,BOTTIGLIA,0 
This is on my todo-list but for the moment I do not have more time and wanted to release the version with syntax check bugfixes!
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

I've briefly tested what you said and it seems ok, very good job !

btw..... I will reserve myself to recheck the Syntax Check and if all is ok, I will test the code generation, the tokenizer :wink:
Mega-Cart: the cartridge you plug in once and for all.
User avatar
GreyGhost
Vic 20 Nerd
Posts: 525
Joined: Wed Oct 05, 2005 11:10 pm

Post by GreyGhost »

I noticed BaseEdit doesn't like the color purple. I crunched a program with a PRINT statement in it that used the color purple. It turned the usual character(half checkerboard half filled space) into a reverse shift L.

I also noticed that if I use Convert to Labels and then Convert to Line Numbers, I noticed it is joining commands after a RETURN statement, rendering those commands basically invisible to the program. The line That its adding past the RETURN command is not referenced by the program at all. It is only used when I need it, as in: RUN 10000. I do this some times to run a disk error check program. In this case, all the little snippet does is display a redefined character set, so I can reference it. If you need me to send you the file let me know, and I will.

Later,
Rob
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Of course RETURN should be handled like THEN, it must finish the actual line when crunching. Didn't thought about that.
And I will have a look at the "print purple issue", but this may take a while as I'm off for two weeks or so...
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

As time goes by... The last months where very busy and I hadn't any time for my VIC-20. And as it seems I won't have much more time in the following months so I thought I should take the opportunity to release the sources of my BasEdit.NET to the public domain.

If anyone is interested just grab the sources at http://www.stojalowski.de/files/BasEditNet_SRC.zip

It's a Visual Studio 2010 project, should load just fine with the express version of VB.NET 2010.
Do what you want with it, rip it apart, use the parts of it which suit your needs or simply ignore it :-)
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

Thank you from the Vic-20 community !
Mega-Cart: the cartridge you plug in once and for all.
wimoos
Vic 20 Afficionado
Posts: 348
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Post by wimoos »

Schlowski wrote: After some more thoughts I think Basic V2 simply has 3 comparison flags for <, = and > and simply checks if these operators are present. Afterwards the values left and right of these operators will be compared and then Basic will evaluate if the comparison result matches with one of the available flags.
This is true. A mask of 3 bits, representing each of the comparison operators is built by the interpreter, from the Basic programtext. This can be 1, 2 or 3 bits set.
Then the difference between the two values is calculated and from the sign of the result (>0, =0, <0) a mask is built with one bit set in the appropriate position.
Both masks are ANDed and when the result is zero, the answer of the comparison is false, otherwise true (set to -1).

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
User avatar
plbyrd
Vic 20 Hobbyist
Posts: 135
Joined: Tue Jun 01, 2010 9:32 pm
Website: http://thesharp.ninja
Location: Clarksville, TN
Occupation: Software Engineer

Cannot convert to Labels

Post by plbyrd »

I have a HUGE source file that is full of spaghetti that is dying to be converted to labels. However, when I try to do so I get the following exception:

Code: Select all

System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at BasEdit.modUtility.GenerateLabels()
   at BasEdit.frmMain.ConvertLineToLabelsToolStripMenuItem1_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I cannot post the code here for privacy reasons, so if you can email me directly at plbyrd at gmail dot com I'll send you the file causing this problem.
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Mail sent to plbyrd...
Post Reply