User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 9:55 pm

Glad to see you got your ScriptBasic working. Is the sb.sh problem still an issue?

I'll see what I can do about fixing Gitlab CE to include the 8181 port in the clone link.

Update:

8181 in clone url now works.

Heater,

If you would like to create a brief guide to build and install a local runtime for the README.md, I think it would help others so they don't fall into the same sink holes.

Airr
Posts: 19
Joined: Sun Jun 16, 2019 5:17 pm

Re: ScriptBasic

Mon Jun 17, 2019 11:53 pm

Fresh install of antiX in a VM.

No prior installs of SB.

cloned the repository, installed the *-dev packages, ran "./setup"

ran ./mkdist.sh ~/sb

cd 'd to /usr/local (as a test)

sourced the sb.sh file (. ~/sb/sb.sh)

Cd'd into my Projects folder, ran "scriba newfib.sb".

No issues.

Rebooted several times and repeated the steps above. No issues.

AIR.

EDIT: Added the following to my .bashrc:

Code: Select all

[[ -f $HOME/sb/sb.sh ]] && . $HOME/sb/sb.sh
Restarted several times, scriba is persistent now.

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 1:17 am

@All,

I would love to hear your suggestions how building and installing a ScriptBasic runtime could be improved. (setup -> mkdist) Is git clone the new apt-get?

ScriptBasic's build system is comprehensive and flexible. I wouldn't want to have to build a configure script to duplicate it. My vote is use Peter's build system if you plan on doing development. (create extension modules) and a standard make with static resources. (pre-built headers and docs)

Should we use building Python as an example? (ScriptBasic isn't in any Linux distribution repositories which makes apt-get not an option.

Can apt-get be used to install from a private server? (location option) Yes but it takes some work.

Code: Select all

At a shell prompt (in a terminal), run

sudo apt-get install build-essential 

This will fetch all the common packages you need to build anything (e.g. the compiler etc.).

Then run

sudo apt-get build-dep python2.7

This will fetch all the libraries you need to build python.

Then download the source code for python and decompress it into a directory.

go there and run

./configure --prefix=/path/where/you/want/python/installed

Then make and then make install to get it built and installed:

make && make install
@AIR,

Since the build number is a text file resource, can the build number be incriminated with commits?

Heater
Posts: 12634
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Tue Jun 18, 2019 5:46 am

Airr,

Yes, starting from nothing worked for me.

The issue is that I started from the "cleanup" branch, which I got working.

Then changed to the "master" branch with

$ git checkout master
$ git pull

Then rebuilt it:

$ ./setup
$ mkdir
$ ./mkdist ../scriba

The resulting build did not work. Tried deleting my scriba directory. Tired a few times.

It only started to work again when I deleted everything and started again from a new git clone.

This makes me suspect that, may be, old build products were not being rebuilt.

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 6:12 am

After I build an extension module with the following

./setup --module=gmp2

If I make any changes I use make -B in the extensions directory to make sure it rebuilds everything.

Heater
Posts: 12634
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Tue Jun 18, 2019 6:27 am

The expected normal way to do this is:

$ make clean

To remove all build products.

It did not occur to me to use that here because we are using a weird build system.

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 7:40 am

Is it easier to learn programming starting in the console or something like Visual Studio?

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 7:51 am

Where is ScriptBasic lacking, my take.

1. If your going to bother checking syntax and report an error, at least be verbose about it and not play let's solve the mystery.

2. Bring extension module COMMADs out of the API closet to extend the syntax of the language not just adding functions.

3. Not taking a ride in a popular distribution.

hippy
Posts: 5344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Tue Jun 18, 2019 10:09 am

Heater wrote:
Mon Jun 17, 2019 9:37 pm
The clone button in the repo does not give the right URL with the port number in it.
Thanks for figuring that out. Finally got "git clone" to work and can build and install from that on my Pi.
ScriptBasic wrote:
Tue Jun 18, 2019 1:17 am
Can apt-get be used to install from a private server? (location option) Yes but it takes some work.
With the right infrastructure in place to support package delivery it is, from a user's perspective, as simple as adding an appropriate line to "/etc/apt/sources.list", typing "sudo apt-get update", "sudo apt-get install".
ScriptBasic wrote:
Tue Jun 18, 2019 1:17 am
Should we use building Python as an example? (ScriptBasic isn't in any Linux distribution repositories which makes apt-get not an option.
You seem to be conflating two use cases. Users will want to use "sudo apt-get install" and have no building to do. Developers will use "git clone" and then build from source. There is nothing wrong with the ScriptBasic build system which exists other than making it work for people for whom it doesn't and documenting things which need to be documented.

What users are lacking is "sudo apt-get install" for ScriptBasic. How Python is won't help with that because it is an available package. You need to look at how those who are creating non-available packages are making their packages available for "sudo apt-get install" to use.

I would have thought GitHub and friends would include package distribution support but it's not something I have ever looked at doing.

User avatar
rpdom
Posts: 14425
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: ScriptBasic

Tue Jun 18, 2019 10:21 am

hippy wrote:
Tue Jun 18, 2019 10:09 am
You seem to be conflating two use cases. Users will want to use "sudo apt-get install" and have no building to do. Developers will use "git clone" and then build from source. There is nothing wrong with the ScriptBasic build system which exists other than making it work for people for whom it doesn't and documenting things which need to be documented.
That depends on the developer.

A developer who wants to try out new things with script basic might want to git clone the repo and build from source so they can add functions or try and correct any bugs they find.

A developer who just wants to use ScriptBasic as a tool won't want to mess around with that and will just want to apt install it so they can get on with whatever project they are working on.

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 10:34 am

Heater,

make clean works from your home sb source directory.

Code: Select all

[email protected]:~/sb-dev-clone/sb-dev$ make clean
rm -rf bin/exe/*
rm -rf bin/include/*
rm -rf bin/lib/*
rm -rf bin/make/*
rm -rf bin/obj/*
rm -rf bin/var/*
rm -rf bin/mod/*
rm -rf *.h
[email protected]:~/sb-dev-clone/sb-dev$ 

hippy
Posts: 5344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Tue Jun 18, 2019 10:52 am

ScriptBasic wrote:
Tue Jun 18, 2019 7:51 am
1. If your going to bother checking syntax and report an error, at least be verbose about it and not play let's solve the mystery.
Needing to be more verbose is not the issue, consider -

Code: Select all

test.sb(1): error &H77:syntax error during checking the line and also
noting that the syntax error so serious that none of the other syntax 
defintions can match the current line.
That is simply far too verbose. It should have ended after "syntax error". The rest is utterly redundant.

What it needs to be is more terse, but more accurate, more specific, more useful, more helpful.

All that lets me know is that something about my source line is wrong. It doesn't tell me what. In this case, this would have been so much more useful -

Code: Select all

test.sb(1): error &H77: no such command as "printf"
I don't need to waste hours staring at code I think is right because it looks right to me, trying to guess what may actually be wrong with it.

But I am not convinced you can easily make things better because the syntax checking appears to be based on pattern matching; so the compiler doesn't necessarily know why a line failed to match, only that it has.

It may be that the only way to improve on that, and perhaps the easiest way, is to include a pre-compilation syntax check of the source, catch as much as you can, and leave the compiler to catch the rest.

You can also use that pre-compilation stage to convert source code to something the compiler does understand which isn't currently supported, such as comments after a command, multi-line statements.
Last edited by hippy on Tue Jun 18, 2019 11:03 am, edited 1 time in total.

hippy
Posts: 5344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Tue Jun 18, 2019 10:54 am

rpdom wrote:
Tue Jun 18, 2019 10:21 am
A developer who just wants to use ScriptBasic as a tool won't want to mess around with that and will just want to apt install it so they can get on with whatever project they are working on.
That's a developer wearing a "user" hat.

By "developer" I was meaning, had hoped to imply, someone who wants to develop or extend ScriptBasic.

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 11:09 am

Vaiid syntax checking and informative error reporting is spoty. Error reporting in extension modules is even worse depending on the author.

hippy
Posts: 5344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Tue Jun 18, 2019 12:03 pm

ScriptBasic wrote:
Tue Jun 18, 2019 11:09 am
Vaiid syntax checking and informative error reporting is spoty.
It's downright useless.

It is arguably the worst things about ScriptBasic from a user's perspective, though there's so much to choose from.
ScriptBasic wrote:
Tue Jun 18, 2019 11:09 am
Error reporting in extension modules is even worse depending on the author.
But those are run-time errors so a different class of error.

My GPIO extension module catches errors but then simply ignores them, because how I am meant to handle them does not seem to be documented anywhere. How I am doing things does not seem to reflect how things are done in other extensions which do things differently, so they aren't a usable reference.

How for example do I raise an error when a pin number may be negative ... ?

Code: Select all

besFUNCTION(GPIO_readPin)
  long pin;
  besARGUMENTS("i")
    &pin
  besARGEND
  if (pin < 0)
  {
    //-- ?
  }
  besRETURN_LONG(readPin(pin))
besEND

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 5:53 pm

Take a peek at the MySQL extension module as it has error handling support that you can use as an example. Maybe AIR can be more helpful with a better answer.

Heater
Posts: 12634
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Tue Jun 18, 2019 6:01 pm

hippy,
How for example do I raise an error when a pin number may be negative ... ?
Why, return an imaginary result of course :)

But if pin numbers cannot be negative how come they are not held in an unsigned long rather than a signed long?

If it were unsigned there would not be this problem.

About error messages:

When I forget a comma, like so:

Code: Select all

PRINT hfibo(4784969) "\n"
I get this error message:

Code: Select all

hfibo.sb(25): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
Which is very long and verbose and mostly useless.

It may as well bail out with:

Code: Select all

hfibo.sb(25): Syntax error.

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 6:34 pm

Taking a look at errors.def and errcodes.c which could be helpful.

I agree and will be changing that error message in a future update. (undefined syntax error encountered)

I would still like to see scriba officially change its name to sb. Until then feel free to rename it to whatever you like after it's built.

@ejolson can rename his ScuptBasic to fiba. :D


FIXED errors.def - line 287
errors.def_change.png
errors.def_change.png (33.5 KiB) Viewed 1159 times

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 8:51 pm

AIR and Others,

Due to Peter's refusal to take down the ScriptBasic.com site or indicate the site is for historical purpose, I vote we fork SB to OSBasic. The name indicates Open Source and an Operating System BASIC.

My understanding is Peter has no interest returning to his C past.

Your thoughts?

ejolson
Posts: 3039
Joined: Tue Mar 18, 2014 11:47 am

Re: ScriptBasic

Tue Jun 18, 2019 8:54 pm

ScriptBasic wrote:
Tue Jun 18, 2019 8:51 pm
AIR and Others,

Due to Peter's refusal to take down the ScriptBasic.com site or indicate the site is for historical purpose, I vote we fork SB to OSBasic. The name indicates Open Source and an Operating System BASIC.

My understanding is Peter has no interest returning to his C past.

Your thoughts?
Maybe call it ScriptBasic2.

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 8:58 pm

No matter what direction or name is chosen, SB needs a serious update with its wardrobe.

English isn't Peter's native language and it shows in the documentation, error messages and syntax like JOKER.

OSBasic could also stand for Old Script Basic. :o

I just registered OSBasic.org and proceeding to setup the hosting resources for the new forked project. If there is anyone that has web design skills that would like to give OSBasic its new image please let me know. This migration is going to happen over time so the ScriptBasic resources aren't going away soon.

hippy
Posts: 5344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Tue Jun 18, 2019 11:09 pm

ScriptBasic wrote:
Tue Jun 18, 2019 5:53 pm
Take a peek at the MySQL extension module as it has error handling support that you can use as an example.
hippy wrote:
Tue Jun 18, 2019 12:03 pm
How I am doing things does not seem to reflect how things are done in other extensions which do things differently, so they aren't a usable reference.

ScriptBasic wrote:
Tue Jun 18, 2019 5:53 pm
Maybe AIR can be more helpful with a better answer.
Hopefully. It just surprises me there are rarely any straight answers, simple "just do this..." solutions.

IMO the example I gave, or something very much like it, should be the textbook example of how to do error handling in the documentation.
Heater wrote:
Tue Jun 18, 2019 6:01 pm
But if pin numbers cannot be negative how come they are not held in an unsigned long rather than a signed long?

If it were unsigned there would not be this problem.
That was merely a simplistic, minimal example. Maybe I should have compared against the upper limit rather than lower. In practice it's more complicated. The range has to be checked and then whether that particular pin is allowed to be used or not.

But the issue is how to raise an error, not how we get there or avoid getting there.

hippy
Posts: 5344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Tue Jun 18, 2019 11:20 pm

ScriptBasic wrote:
Tue Jun 18, 2019 8:51 pm
I vote we fork SB to OSBasic. The name indicates Open Source and an Operating System BASIC.

Your thoughts?
It would be best not to use the name of any another basic which already exists and compound the nightmare further -

https://code.google.com/archive/p/osbasic
https://freebasic.net/forum/viewtopic.php?t=16037

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Tue Jun 18, 2019 11:57 pm

Wow!

I did a search for OSBasic and nothing showed up. The domain was a a available which was a plus. I agree that it would only cause more confusion.

I'm taking suggestions for a name for a forked ScriptBasic project.

User avatar
ScriptBasic
Posts: 1232
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Wed Jun 19, 2019 12:20 am

Maybe a better way to go then a full separation from ScriptBasic is do a platform specific fork. We already have the RaspberryBASIC domain which would work as a RPi tuned version supported by the RPi community.

There is a lot of history and resources behind the ScriptBasic project that should probably remain.I view ScriptBasic as a launchpad project. It's been around now for 20+ years. One of the most timeless languages I have used.

Return to “Other programming languages”