New games every week!
JSE - Brackets!! Blog
25th June 2021
On the subject of brackets, Michael suggests..

-=-=-

I think one thing that could help some of the problems would be to somehow print out parse errors.


Yeah, errors would DEFINITELY be a great help.
I've started adding a few errors here or there, but the main issue here is that.. There isn't an error to report!! The engine carries on, for the most part, and that's mostly in the way it was designed.

There's also the fact that the error reports will be mangled. By the time any kind of error has happened, the script has been juggled and jumbled about to an almost unrecognisable style.

For example make it so all functions are required to have (). If they dont print an error and dont allow it to run. In your example it would fix some of the guessing with KeyHit and MouseHit.


Careful what you wish for!!
If "ALL" function require brackets, then even Print("Hello World") would need one.

Goto(10)?

Im sure there are lots of places where you can take problems from guessing what the user wants away by enforcing some standards.


The more strict standards there are, the less freeform the language becomes. The whole point of the language is that it should be as reusable as possible.
People coming from Blitz, SmileBASIC and even retro BASIC's should be able to type thing in the manner they're used to, and .. for the most part, they should work.
I'm still slightly annoyed that I can't have Print "Hello"; because the ; has been used for command separation. That's enough!!!

Currently the parser tends to run forwards.. line by line, left to right.
I'm now finding myself wondering what might happen if I try reading a couple of routines backwards..
Could that allow me to figure out which bits are parameters, easier?
Might I be able to tie everything into brackets a little better?!
Hmm..

Once you add an error checking pass Im sure you will find lots of other things to check for that will help get rid of problems and bugs.


Yeah, those would definitely help matters. I do need to get a few more errors up and running.

I had other idea which Im sure you will hate since it goes against the format of older Basic and Blitz Basic.

It might make it more complex or confusing or expose other pitfalls or problems I'm not thinking about.

My idea is to change the () for functions to be []. Instead of MouseHit() you have MouseHit[].

This would take away any issues that come from if its a function () or just a normal ().


.. Surprise!!!
['s and ('s are interchangeable!!!
I was tempted to make {'s work, too, but figured that those might become a little more confusing than they oughta be. { and } are typically surrounds for functions/loops/etc.

Oddly, they don't work with Arrays, though, which was kinda the whole point (Most modern arrays tend to use ['s instead of ('s ) but I think that's a case of the interchange happening too late in the parser. I'll have to look into that.

Meanwhile...



I've been mostly taking a rest from figuring this out, today.
I coded this, instead.

// Swirly Mystify // by Jayenkai // Created 2021/6/25 Graphics 512,512,2;Border 30,30,80 w=ScreenWidth()/2 h=ScreenHeight()/2 Dim Point(100,2) For p=0 to 36 Point(p,1)=w Point(p,2)=h Next Repeat sx=Sin(Mills()*0.01)*2 sy=0-Cos(Mills()*0.03)*2 Scroll sx,sy r=Abs(Sin(Mills()*0.02)*60) g=Abs(Sin(Mills()*0.015)*60) b=Abs(Sin(Mills()*0.01)*60) CLS r,g,b,0.05 ResetDraw SetBlend "Light" For p=0 to 35 // Movement v=(p+20)*0.025 x=w+Sin(v*Mills()*0.03)*w y=h-Cos(v*Mills()*0.08)*h Point(p,1)=SmoothTo(Point(p,1),x,p+32) Point(p,2)=SmoothTo(Point(p,2),y,p+32) Next For p=0 to 35 // Drawing SetThick 1 InkRot((Mills()*0.05)+p*10,1,0.3);SetAlpha 0.35;if ((p mod 9)==0) then SetThick 3;SetAlpha 0.75 p2=(p+18) mod 36 Line(Point(p,1),Point(p,2),Point(p2,1),Point(p2,2)) p2=(p+9) mod 36 Line(Point(p,1),Point(p,2),Point(p2,1),Point(p2,2)) p2=(p+27) mod 36 Line(Point(p,1),Point(p,2),Point(p2,1),Point(p2,2)) Next Flip Forever

Views 233, Upvotes 11  
Daily Blog
New games every week!
Site credits : Jayenkai put all his heart and soul into everything you can see on this site.
(c) Jayenkai 2023 and onwards, RSS feed 4

Blog - JSE - Brackets!! - AGameAWeek