Standalone compiled code, e.g. exe?

Started by lettersquash, May 12, 2021, 21:28:19

Previous topic - Next topic

lettersquash

Hi Chris,

I saw this question come up quite a while back, and it got lost in amongst arguments about editors and other things. Is there any plan to allow SmallBASIC source to be compiled to a stand-alone program that can be distributed with obscured source (or even with open source)?

I'm wondering about using sB for something, but it needs to be easy for end users to install or unpack and run without loading a file into an editor first.
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

bplus

I might be able to convert something and compile for you in QB64. Is it very long?
1 person likes this

lettersquash

Quote from: bplus on May 13, 2021, 00:13:27
I might be able to convert something and compile for you in QB64. Is it very long?
That sounds interesting. I gathered from earlier that it's possible to do that. It's a kind offer, or I might be able to do it myself if I learn the QB64. I may have looked at it, but I can't remember why I didn't use it.

It's nowhere near finished, I've got to learn a lot, and it could be pretty long and pretty complex by the time I'm done - it might not even come about. SB is just one of my options, but it's got potential. Ideally, I'd want to have an app that runs in Android too, and preferably Linux, but Windows would be a start.

Another option would be to use another language (AHK) for the Windows version and find something else (sB, or maybe RFO BASIC) for Android.

Anyway, thanks bplus. It's possible Chris is working on something to write an app straight from sB. I've no idea how easy or difficult it is.
Cheers mate,
¬~
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

chrisws

For windows and linux you could use the command line version and then just supply the .sbx byte-code file instead of the corresponding .bas file.

You could then provide a GUI using one of the modules.

For android, with some effort it would be possible to make some kind of development kit where you use the core of SmallBASIC but package it as your own app.

round157

Quote from: chrisws on May 13, 2021, 06:20:40
For windows and linux you could use the command line version and then just supply the .sbx byte-code file instead of the corresponding .bas file.



Hello, the description for making .sbx file is not clear. I can't make .sbx file successfully:


new: ebm, optional SmallBASIC.ini settings control creation of .sbx files
    --- and enabling verbose compilation. settings are:
    --- genexe=0
    --- quiet=0

(https://smallbasic.github.io/pages/changelog.html)

chrisws

In the console version you can pass the -x option

$ sbasic -x foo.bas

This will run foo.bas and also produce foo.sbx

Now you can run:

$ sbasic foo.sbx

You can also kind-of de-compile the sbx with:

$ sbasic -s foo.sbx

This gives an idea of what's inside but the original source isn't recoverable.

lettersquash

Thanks Chris. With my level of knowledge, that all sounds a bit beyond me, unfortunately. I haven't really worked out how the modules work. If at some time there's a compiler that will do all that, it would be a great addition.
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

bplus

This reminds me you could compile or precompile Unit code if I remember correctly.

So what if you make an executable from that? Maybe still needs a really simple little sb line of code to activate, so still need sb to distribute, but we are getting closer aren't we?
1 person likes this

round157

Maybe many SmallBASIC users want a more convenient solution for making EXE files. I really hope that chrisws will create a new solution. Thanks first!  :)

lettersquash

Quote from: round157 on May 22, 2021, 11:06:38
Maybe many SmallBASIC users want a more convenient solution for making EXE files. I really hope that chrisws will create a new solution. Thanks first!  :)
Yes, or it might be someone else skilled enough who writes a utility for that. I wouldn't know where to start.
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

bplus

(Oh hey I got a message! Better yet it's in sb code, wouldn't have known had I not logged in to post this! LOL)

QuoteI wouldn't know where to start.

I am pretty sure you do know how to start but in case you don't, pick a language to write it in, say C++ then look it up on Internet:

Bam! someone is showing you how LOL
https://visualstudiomagazine.com/articles/2014/05/01/how-to-write-your-own-compiler-part-1.aspx

I am thinking it is a big project because I've built many an interpreter but I don't have the desire to overcome all the other things needed time, effort, skill... it would take more desire.

Plus QB64 doesn't have all the functions sb has but it's not hard to fill in missing subs and functions to get a compiled program. Just the other day, I was wondering how I would do Translate, oh that's easy but doing that Pairs thing, a little more tricky ;-))
1 person likes this

lettersquash

Quote from: bplus on May 22, 2021, 17:12:41
(Oh hey I got a message! Better yet it's in sb code, wouldn't have known had I not logged in to post this! LOL)

QuoteI wouldn't know where to start.

I am pretty sure you do know how to start but in case you don't, pick a language to write it in, say C++ then look it up on Internet:

Bam! someone is showing you how LOL
https://visualstudiomagazine.com/articles/2014/05/01/how-to-write-your-own-compiler-part-1.aspx

I am thinking it is a big project because I've built many an interpreter but I don't have the desire to overcome all the other things needed time, effort, skill... it would take more desire.

Plus QB64 doesn't have all the functions sb has but it's not hard to fill in missing subs and functions to get a compiled program. Just the other day, I was wondering how I would do Translate, oh that's easy but doing that Pairs thing, a little more tricky ;-))
That's funny, when I said "someone", I was thinking of you! Oh well, never mind. Yes, I would - strictly speaking - know where to begin. Running away. :P
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.

round157

Quote from: Aurel on May 22, 2021, 20:13:46

BUT if the runtime core is too multiplatform then is not easy to create binder...

So the above conclusion is almost the same as no solution.

Quote
well many users..yeah ..many ...
where are those many ?

Perhaps most of the SmallBASIC users only like to write programs sliently at home and don't use this SmallBASIC forum.

round157

Quote from: lettersquash on May 22, 2021, 16:33:08
Quote from: round157 on May 22, 2021, 11:06:38
Maybe many SmallBASIC users want a more convenient solution for making EXE files. I really hope that chrisws will create a new solution. Thanks first!  :)
Yes, or it might be someone else skilled enough who writes a utility for that. I wouldn't know where to start.

Maybe "generate EXE file" should be the highest priority task on the roadmap, the to-do list or the wishlist of SmallBASIC.

lettersquash

Quote from: Aurel on May 22, 2021, 20:13:46
Do i really need to repeat myself
No, but it never stopped you before. :P

Quote
well many users..yeah ..many ...
where are those many ?
They're all using your software. :))
I'll have you know, I'm coding all the right commands, just not necessarily in the right order.