Saturday, March 29, 2014


I've been writing a new scripting language for the past week and I call it "ZerothScript" or "ZS".

ZerothScript ("ZS") is a hybrid typed, object-oriented scripting language. By hybrid typed, I mean, it will allow the retyping of a variable after initialization. The type checking of USL is absent in ZS. Variable types will be declared statically; however, the types can be dropped and replaced with other types. When the type changes, the value changes accordingly.

ZS will feature a programmable interactive shell, just like USL, except the concept of the shell has been abstracted and divided into three main components: the engine, the interpreter, and the parser. The engine can be best understood as just a means to receive input from the user (or via script). The parser is the first to touch the input, and depending on whether it's something the parser handles (creating a new shell, exiting the shell), it will pass the appropriate values back to the engine. If the engine gets a request for a new shell, it will add a shell and attach that shell to the interpreter. The shell is a stateful creature and an interesting data structure (in my opinion) because it is basically a giant container of information (starting off small of course). If the engine gets an unhandled response, it passes it off to the interpreter for interpretation. The interpreter is attached to the current shell in the engine, so anything that happens in there will be reflected in that particular shell.

This is the core of ZS. The rest will come in time as I continue its development.

ZS already has a skeleton for a cool error handling system and a cool debug mode logging utility. When I have some cool ideas, I'll jot them down in code. Here's an example of what I expect the finished product to look like:

# begin example script

class Object
        _id as String
        def new(id as String)
            self._id = id
        def getID() as String
            return self._id
        static def sayHello()
            say "Hello, World!"


o ="object")
say "I am an object of type #{Object.class} and I have an ID of #{o.getID()}"

# end of script

Similar to USL, eh?

You can view my progress at GitHub.

No comments:

Post a Comment