PureBasic Forum
https://www.purebasic.fr/english/

New scripting engine - testers wanted!
https://www.purebasic.fr/english/viewtopic.php?f=7&t=69768
Page 1 of 10

Author:  srod [ Tue Dec 12, 2017 5:04 pm ]
Post subject:  New scripting engine - testers wanted!

**EDIT : I have made the test files available to all. More details in a separate posting below.

DOWNLOAD minScript

================================


Hi,

I have a new scripting engine completed in PB and am looking for a handful of hearty souls to help me test this swine! :)

My first attempt at a useable scripting engine (eScript) turned out to be wholly unsuitable for a number of reasons, including the fact that it was an absolute bugger to actually integrate into a wannabe host app! It was also difficult to extend in that, for example, adding arrays was nigh on impossible - doh! Problem is that it was neither a scripting component or a full interpreted language when, stupidly, it tried to be both of these things!

minScript addresses all of eScript's many short-comings. It has been designed from the beginning for use in apps which either wish to automate some task or other (e.g. application installers) or offer up full scripting to their users.

I reckon I've finally nailed it with this one... but only time will tell.

minScript is pretty lightweight (currently under 12000 lines of OS independent PB code) and is an absolute breeze to integrate into a host app and it is a trivial matter to execute script code. It is simple to extend through the addition of run-time functions and/or user-defined reference types and so the business of customising it for use in a given host environment is straight forward. There are no external dependencies as minScript comes in full source code form.

It probably isn't the right time to outline minScript's features in detail and so I'll just list some of the main ones :

  • A small flat c-style API to customise the hosting environment by adding run-time functions and the like
  • A simple OOP interface for working with scripts
  • A large set of standard runtime functions included
  • Full compilation of scripts (to byte code) using a top-down recursive parser
  • Scripts are submitted for compilation in the form of modules. Add as many modules as you wish, when you wish. You do not need to submit code all in one lump!
  • Simple debugging features (I did not go overboard here - simple is good inmo!)
  • Full garbage collection.
  • Simple VB type syntax. Mix procedural and OOP syntax.
  • Code modules.
  • Classes and user-defined types
  • Arrays (inc arrays of arrays of arrays... and arrays of class objects etc.)

And so on!

To assist with testing (and instructing others how to code in minScript's language) I have created a simple editor which can be used to run and test scripts. It also serves as a non-trivial demo in how to make use of minScript.
I have already created a few test scripts which can be loaded into the editor, but I will be adding more and more as and when I can.

The hope is that I can fix bugs and add whatever obvious features I may have overlooked whilst working on more demos and the docs etc.

I don't have anywhere to upload the files at this time which is why I am just asking for a few testers to whom I can just email the package to as opposed to just opening up the testing to all.

Please send me a pm with an email address if you are interested.

Thanks.

Author:  jack [ Tue Dec 12, 2017 7:28 pm ]
Post subject:  Re: New scripting engine - testers wanted!

sounds very interesting, I don't qualify as a tester but am curious to know wether it will be a commercial product or free?
am looking forward to try it out when it's made available to the general public.

Author:  srod [ Tue Dec 12, 2017 8:49 pm ]
Post subject:  Re: New scripting engine - testers wanted!

jack wrote:
sounds very interesting, I don't qualify as a tester but am curious to know wether it will be a commercial product or free?
am looking forward to try it out when it's made available to the general public.


Freeware.

Author:  Zebuddi123 [ Tue Dec 12, 2017 10:13 pm ]
Post subject:  Re: New scripting engine - testers wanted!

Hi srod. As like Jack I Don`t qualify as a tester but I`m definitely interested. Nice to know your back :)
Zebuddi. :)

Author:  srod [ Tue Dec 12, 2017 10:53 pm ]
Post subject:  Re: New scripting engine - testers wanted!

I never really went away - just struggled to find much time for any coding. :)

Things have evened out a lot more now in terms of the amount of spare time I have and so I can code more!

minScript has taken quite some time to get it to this stage mind; mostly due to the aforementioned previous lack of spare time.

Author:  Justin [ Tue Dec 12, 2017 11:17 pm ]
Post subject:  Re: New scripting engine - testers wanted!

Sounds cool. Can the host app comunicate with the scripts passing and returning vars or objects?

Author:  srod [ Wed Dec 13, 2017 11:38 pm ]
Post subject:  Re: New scripting engine - testers wanted!

Justin wrote:
Sounds cool. Can the host app comunicate with the scripts passing and returning vars or objects?


The short answer is, yes. :)

If you are asking whether you can pass values in and out whilst a script is running then yes, you can do it through various mechanisms.

The easiest option is to simply pass values in when invoking a script function and then retrieving any return value. That of course is a fundamental requirement for any script engine. :) Incidentally, you do not need to invoke a full function in order to execute a script. minScript supports pre-compiled 'code snippets' which the host app can stash away and execute at any time and are intended for rapid and repeated execution etc. These snippets can then call into module functions and classes etc. The point is that you don't necessarily need to regard a script as a single large entity if you also make use of these snippets.

Second option is the fact that both the host app and scripts can set and retrieve the values of what we have called 'script variables'. These are top-level global variables (we have several levels of global variables). For example, the host app could create an array and assign it to a script variable and then this would be available to any script running under the relevant code object. This is a simple way of a host app communicating with a script etc.

Third option is the use of run-time functions. The host defines a run-time function which can be called by a script. Communication can thus be facilitated this way. In fact a run-time function can execute additional scripts if it so wishes - so scripts running within scripts!

Another more advanced option is through the use of what we have termed 'user-defined reference types'. These are similar to script classes (which minScript offers), but their definition and implementation sits in the Purebasic host app. For example, we have implemented arrays through the use of a suitable user-defined type (and script classes as it turns out!)
So if I use an array as an example, a script can create an integer array (for example) and assign it to a local variable. Whenever this variable is then acted on by a script (e.g. setting the value of one of the array elements) then control passes to the the host app (similar to a run-time function) in order for the relevant PB code to do it's thing!
This is an advanced option because user-defined types, for one thing, impact upon minScript's garbage collector and additional code has to be provided by the host to assist the garbage collector dispose of any 'wayward' instances of the underlying user-defined type. We had to create 'garbage collector extensions' for both arrays and script classes and these can be fiddly.

Don't let this last option put you off mind as very very few people would need to concern themselves with implementing a user-defined type. I fully intend to add hash maps (in the form of Javascript style objects) and this will be a relatively simple application of the aforementioned user-defined types. Once I have created them then all users of minScript will be able to use them. :)

There is one last way of a host app communicating with a script (and vise versa) and that is through a debugger - though any such communication is rather limited as I have deliberately not overloaded minScript's debugging capabilities. I made that mistake with eScript!

I hope that answers your question.

Author:  Kwai chang caine [ Sat Dec 16, 2017 7:53 pm ]
Post subject:  Re: New scripting engine - testers wanted!

Obviously, if you need someone for breaking your code and found much more bug what you have never dreaming...i'm your Grasshopper :mrgreen:
The other members say not be a tester...me i'm not sure i can run your futur jewel :oops: nut i promise you i try ..

Since all this time, you have helped me, one thousand of time, it's time to try to return to you 0.0000001% of your help.
If you need a donkey pure butter in your team...don't forget your little servent KCC for the life :D

Author:  srod [ Sun Dec 17, 2017 9:52 am ]
Post subject:  Re: New scripting engine - testers wanted!

Thanks KCC. You definitely give new meaning to the term 'code breaker', though I am not sure Alan Turing would have approved! :)

Truth is that I am all the code breaker that is needed right now. In fact, breaking the code is easy; it's putting it back together again that is the problem! :) Damn garbage collector is giving me a headache, though I think I have it sorted now.

I'll put minScript out for all interested parties to tinker with pretty soon. Just want to finish hashmap and 'collection' support and a few other bits and bobs, not to mention the many bugs I keep finding, fixing and reintroducing with a vengeance! Damn bugs keep morphing into more complex entities. I swear some of these bugs I have created are damn near sentient; I caught one of them trying to hack into my own bank account when I specifically instructed it to hack into Fangbeasts many offshore accounts. That wasn't difficult mind when he has set all of his passwords to 'sheeploversanon'.

:)

Author:  srod [ Thu Dec 21, 2017 12:58 pm ]
Post subject:  Re: New scripting engine - testers wanted!

For anyone who wants to help out with the testing of minScript (or just wants to take a quick peek!) then I have temporarily uploaded the latest test version to my work's webspace. I will sort somewhere more appropriate after Xmas.

This is just a test version remember (v 1.0.1) so don't be alarmed if it misbehaves a little bit, especially as this latest version comes straight after some quite severe alterations to the compiler. What am I saying? Scratch that and don't be alarmed if it misbehaves a whole heap and turns your computer into a smoldering heap of molten plastic! :)

Please read the appropriate 'read me' before starting which will direct you to the simple 'qdMin' editor (and instructions on how to run it!) which is the best place to start along with the various demo scripts I have thrown in to the mix. I used (and still use) these scripts to test minScript. qdMin only allows a single code module and does not provide access to the global class library, but it is still more than adequate for testing scripts and the like.

For those wishing to delve deeper; in the 'specifications' folder you will find a bunch of text files outlining some of the finer details of minScript and how it works etc. These details will of course find their way into the docs I will eventually produce for minScript. There is also qdMin itself which doubles as a far from trivial demo program, showing, amongst other things, how to integrate minScript into a host app.

DOWNLOAD minScript

Author:  Kwai chang caine [ Thu Dec 21, 2017 5:45 pm ]
Post subject:  Re: New scripting engine - testers wanted!

Hello master of all my life 8)
Thanks a lot for sharing with us

Like promise i have try to only run your splendid jewel.
And like promises, i have already breaking it, after 0.000002 second, i'm really the better of the bad :oops:

I have renamed the
Code:
#minScript_HOME = "E:\A\Q\B\minScript\Source\" 
and i have this :
Quote:
line 1287
blnBracketsEncountered = 1<<62
overtaking error: a value of type long is between -2147483648 et +4294967295.
Quote:
[COMPILER] Ligne 1287: Erreur de depassement: une valeur de type 'long' (.l) est comprise entre -2147483648 et +4294967295.
I use : W7 X86 / V5.61 X86

Author:  srod [ Thu Dec 21, 2017 6:44 pm ]
Post subject:  Re: New scripting engine - testers wanted!

Ah I am running on Winx64... yes that bug is clear - doh!

Let me sort that out.

Thanks Kwai.

**FIXED (version 1.0.2) ** Should run fine on Win x86 now.

Author:  Kwai chang caine [ Thu Dec 21, 2017 7:03 pm ]
Post subject:  Re: New scripting engine - testers wanted!

Quote:
yes that bug is clear - doh!
For MASTER...all is always clear :shock:
Quote:
Thanks Kwai.
For my life your servant MASTER Image

Author:  srod [ Thu Dec 21, 2017 7:19 pm ]
Post subject:  Re: New scripting engine - testers wanted!

Kwai chang caine wrote:
Quote:
yes that bug is clear - doh!
For MASTER...all is always clear :shock:
Quote:
Thanks Kwai.
For my life your servant MASTER Image


FIXED (version 1.0.2).

Should run fine on Win x86 now.

Author:  Kwai chang caine [ Thu Dec 21, 2017 7:28 pm ]
Post subject:  Re: New scripting engine - testers wanted!

Waoooouuuuh !!! Splendid !!! :shock:
Now, i must try to understand how this "space engine" works :mrgreen:
But already...that run
Thanks MASTER 8)

Page 1 of 10 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/