123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|350|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> TinyBasic (TinyBBasic)

Posted : Thursday, 12 April 2018, 10:58
Dan

TinyBasic (TinyBBasic)


Here is the Sourcecode for the TinyBasic, which can be found on: TinyBasic in Runbasic in Webbrowser
converted to run in BlitzBasic (3d).

The code, so far is run-able (haven't tested if it is 100% bug free). This interpreter understands only numeric variables, which can be placed between a to z chars.

I have added a small delay each 2 seconds, to avoid 100% cpu usage. Following line can be commented out:


To break a running program, press Ctrl + D. Auto Loading/Running of an program is also supported, if you save it as 0 (save 0).

p.s.:
The Windows api calls are made only By the Functions, which are not really needed for this interpreter. The needed decls addition are in or before the functions, in the code.
You can safely remove all the Functions and their calls by commenting/removing the Include line, and uncommenting the 2 graphic calls.

p.p.s:
ini functions require the Program to be compiled. If you run in in the Ide, the settings and the programs will be made in the blitzbasic bin folder.

p.p.p.s.
The Graphic calls are intentionally left as ,2 and ,3 (instead of ,6 ,7) because the time call functions need a runable code, if the window looses the focus.




and the include file ScreenIni.bb :



-=-=-
Emu.zone
Posted : Thursday, 12 April 2018, 13:16
Dabz
Pretty cool that!

Dabz
Posted : Saturday, 28 April 2018, 09:35
Dan
Thanks, here is a version 1.1 which someone has updated. (credits are in the comments)

This version is basically the same as the previous with added functionality.
If you want, you can use the include file from the previous post.



The only untested thing is the Month2Num function, as i'm not sure if it will work on every PC (language-wise) as it is.

Edit (4/May/2018) bugfixed version:The older code contained a bug where some functions calls after parentheses would cause an error.
Now the array has the [ ] Brackets instead of normal ( ) ones.

-=-=-
Emu.zone
Posted : Saturday, 28 April 2018, 11:08
Pakz
I noticed a free book a time ago called eloquent javascript and it had a chapter(s?) on creating your own programming language. Yesterday I was thinking I might have a go at figuring out how to add a programming language into my voxel world. But creating a programming language or script language even might be to difficult for me still.

The code here might be useful for me for reference later
Posted : Friday, 11 May 2018, 03:47
Dan
How complicated a scripting/programming language can get, depends on what your script shall do.

I'v found a simple command-executing thing, over on german's blitzbasic forum : commandline interpreter

and replaced the IF statements with Select/Case:



Its nice for a start. The next steps would be to parse the arguments, add variables (if needed), read the script out of the array instead of the input line ...

-=-=-
Emu.zone
Posted : Friday, 11 May 2018, 16:53
Dabz
I did this...

https://sourceforge.net/p/bamboobasic/wiki/Home/

But bare in mind, I'm a plasterer, so the code may seem a mess... But... It worked!

I also recommend if your interested in languages for just a peek, then take a look at the Linux Vala source... Vala is lovely!

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Posted : Sunday, 27 May 2018, 03:05
Dan
Here is another version of TinyBbasic (v1.2).
Some of the Variables have been renamed, the limit of 99 lines per script has been changed to 1000 (can be increased/decreased in this source).

1x 2d and 1x 3d array access and some graphic functions have been added. (type HELP for all commands)
Blitzbasic commands can be easilly wrapped for use with TBB.

Loading and Saving programs work with filename instead of numbers, and reloading the last saved/loaded filename is possible, in case you want to edit the program with Notepad/CrimsonED etc.



-=-=-
Emu.zone