I've been playing around with a experimental script language that executes object code lists directly and am looking for others who might like to help.

The first version was written in python. The original idea came from wondering if it is possible to replace python's byte code with nested object code lists. As I worked on it, it became clear it would also make a nice script language on it's own so I decided to test how it would work independently of python first.

Currently it's implemented in scheme so it can be compiled to C and a stand alone executable.

The design is simple enough that converting it to use python objects and using the python C API should be fairly straight forward.

I can update the original written-in-python version if anyone is interested. It's quite a bit behind the scheme version right now. It might make an interesting module.

Here's a few command line examples...

==> def [hello] [
...     (print "Hello World\n")
... ]
==> (hello)
Hello World

==> set a 23/41
==> set b 3/2
==> (+ a b)
169/82

==> for x [1 2 3 4 5] [
...    (print x "\n")
... ]
1
2
3
4
5

==> set conds [
...     (< a 6)
...     (== b 2)
...     not-done
... ]
==> let [a b not-done] [7 2 0]
==> (or conds)
1
==> (and conds)
0


And of course it does execute files too. :-)

{-------------------------- guess-my-number.mta

    GUESS MY NUMBER GAME

    The computer picks a number and you
    try to guess it.

-----------------------------------------------}

def [guess] [
    set n (random 10)
    set msg "Guess a number from 0 to 10: "
    loop [
        (print msg)
        catch error
            [set g (int (read-line))]
        if (not (empty? error))
            [set msg "What?, guess again: "]
        elif (> g n)
            [set msg "Too high, guess again: "]
        elif (< g n)
            [set msg "Too low, guess again: "]
        else
            [break]
    ]
    (print "Good guess!\n")
]

(guess)


I've been told it looks like a combination of scheme, tcl, and python.

This script-language tests a number of ideas I've been interested in.

Keywords are objects too! They can be bound to names and executed later in another place or returned by expressions to be executed.

Blocks are nested lists of object code that can be passed around. Actually programs are nested lists of object codes. It's just the outer most block.

These features make it an interesting meta language to experiment with.


If you think you may be interested in helping with this project, (It's open source), you can find it here.

    https://github.com/Ronald-Adam/magic-meta

    https://github.com/Ronald-Adam/magic-meta/wiki/1.-Home

I'm hoping some of you may be interested in helping out as a group project with the possibility of bringing some of the ideas back to python in some form. Possibly as a script language that can be used in projects.

There is lots of opportunities to make improvements and additions as there are zero users currently.

It's still very early in it's development, so don't expect too much at this time.

Cheers,
   Ron

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to