Pancho88
Posts: 3
Joined: Wed Feb 21, 2018 4:40 pm

Yet Another Programming Language

Sun Nov 04, 2018 8:56 pm

Hello everyone.

I have a little experience with electronics/rpi linux, but have much experience
programming computers. Browsing the RosettaCode site, i found over 190
programming languages. So i decided to write one more, WSD(Scripting Dynamics).

WSD is written in Ansi C. It was built and tested in Windows, then ported
to Android, and now to RPI zeroW with Stretch Lite.

It is a simple but efficient scripting language. It borrowed some features
from the original Basic language. There is a byte code compiler "<30k", and
byte code interpreters "<30k". It is Open Source, full c source code is available.
Its objective and strength is in scripting dynamic link libraries(shared objects).

Code: Select all

    //Dynamic libraries must have an entry point like this. It serves as a bridge
    //to access its exported functions.
    char * _run(char *proc, int *e, int argn, char **argz) {
    int i, n;
    *e=0;
    if (strcmp(proc, "getJulianDate")==0) {
        n=getJulianDate(argz[0]);
        if (n==-1) {
            sprintf(xbuf, "Error processing Julian Date %s", argz[0]);
           *e=1;
        } else {                
            sprintf(xbuf, "%d", n);
        }
        return xbuf;
    }
    if (strcmp(proc, "getDatefromJulian")==0) {

Code: Select all

    'WSD scripting Julian Date library
    c$=chr(10)
    import juldate
    loop:
        print "enter date mm/dd/yyyy "
        dte$=input
        ln=len(dte$)
        if ln=0 then goto exit:
        if ln<>10 then goto loop:
        jdte$=juldate.getJulianDate(dte$)
        if err then print errmsg & c$ : goto exit:
        print "juldate=" & jdte$ & c$
        goto loop:
    exit:
        end
All the functionality should reside in shared objects. In this example placing
"getJulianDate" function in the byte code interpreter instead of shared object
would have been possible but wrong.

For example, in Windows we have Sqlite.dll which is well documented.
I wrote a rather complex DLL "<8k" which gives access to the main Sqlite functions.

Here we have two different programming efforts, building dynamic libraries, and
writing scripts to those libraries. Like Activex objects(OCX) and vbscript.

I created a simple web site https://wsd.netlify.com where you can find source code,
and more information. WSD seems like a good fit for microcontrollers/SBC.

Try it and let us know your experience.

Bye

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

Re: Yet Another Programming Language

Mon Nov 05, 2018 1:59 am

Pancho88 wrote:
Sun Nov 04, 2018 8:56 pm
So i decided to write one more, WSD(Scripting Dynamics).
Does WSD stand for Windows Scripting Dynamics?

Pancho88
Posts: 3
Joined: Wed Feb 21, 2018 4:40 pm

Re: Yet Another Programming Language

Mon Nov 05, 2018 4:40 pm

Yes.

It was originally built and tested in Windows, then ported to Android, and now to RPI zerow stretch lite.

It is basically the same for all platforms. Its difference is "dlopen vs Loadlibrary".

Its compiled byte code runs with no change in Windows, Android, and RPI.

Bye

Return to “Other programming languages”