MB0 Experimental Language

MB0 Experimental Language

Domain

MB0 is designed for experimental purpose. It has a very simple grammar and syntax following to assembler languages. The current implementation is as an interpreter language.

Syntax

Each line of code has the following form:

[label:] command [var1 [, var2 [, var3 [, …]]] [; comment]

Semantic

Each line is interpreted as a procedure call of “command” with var1, … the call parameters. All parameters are called by name. The content is completely determined by the called procedure.

The procedures are taken from some library that is implemented in any programming language – most likely the language of the implementation.

The library is indexed by the command names. The interpreter implementation provides an interface for the passed variables

If the library procedures fail, the execution is aborted.

Runtime

At runtime, an agent is created. An agent can be seen as a CPU executing the code line by line.

The most simple agent has the following internal states:

IP                  Instruction pointer:
Points to the line of code of the current command. After execution it’s moved to the next line

Active            If true, the agent is active, i.e. executing code

The agent executes the following code (written in some pseudo code):

Start agent
While IP <= last line of code
   Read line at IP
   Lookup command in the library
   If not found abort execution
   Call library procedure with all variables passed by name
   Move IP to next line
End loop

 


Note: this simple agent has no conditional execution.

Implementation

First reference implementation is in Excel VBA.

Library

MB0 comes with a basic library with only string support and simple global variable functionality.

The variables are available as long as the agent is running.

Command list

MsbBox             creates a VBA MsgBox with message var1

Let                     Puts par2 into variable par1

Data Types

Only strings are supported. String constant is indicated by surrounding double quotes.

Leave a Reply

Your email address will not be published. Required fields are marked *