Real-time execution (RTEX) Engine is a fancy interpreter for instructions
Find a file
2022-12-30 03:06:27 -05:00
.idea Added idea files 2022-12-23 00:10:53 -05:00
assets Added instruction_example.png 2022-12-27 00:37:42 -05:00
docs/instructions Refactored Comparators instructions and added documentation 2022-12-30 03:01:38 -05:00
instructions Added base files, with the basic ability to add/remove variables from the Runtime. 2022-12-23 00:10:02 -05:00
src/RTEX Added Exception classes for RTEX 2022-12-30 03:06:27 -05:00
.gitignore Added .gitignore 2022-12-22 23:48:53 -05:00
CODE_OF_CONDUCT.md Added CODE_OF_CONDUCT.md 2022-12-27 00:36:23 -05:00
CONTRIBUTING.md Added CONTRIBUTING.md 2022-12-27 00:36:47 -05:00
LICENSE Added LICENSE (MIT) 2022-12-27 00:36:55 -05:00
Makefile Added base files, with the basic ability to add/remove variables from the Runtime. 2022-12-23 00:10:02 -05:00
project.json Added project.json 2022-12-23 00:10:25 -05:00
README.md Updated README.md 2022-12-27 00:37:08 -05:00

RTEX Engine

RTEX Engine (Acronym for Real-Time Execution Engine) is a real-time execution engine for the execution of instructions represented in associative arrays in a controlled environment. RTEX is designed to be used in such environments where you are automating the task of creating scripts for your program to run, or you are executing programs written by users, but you don't want to give them the ability to execute arbitrary code on your system

How does it work?

RTEX Engine operates on the simple principle of executing instructions in order, and then moving on to the next instruction.

Instructions

Instructions are simply associative arrays that contain information about the instruction to be executed. The engine will then execute the instruction, and then return the context back to the caller.

Note: The below is just an example of what an instruction might look like. The actual instructions are not implemented

Instruction Example

RTEX Engine provides a limited set of instructions by default allowing for basic functionality and operations, the builtin functions do not provide a way to interact with the host system or the filesystem, but you can extend the engine with your own methods and namespaces

JSON Representation

Since instructions are associative arrays, they can be represented in JSON, which is a common format for data transfer. The following is an example of a set of instructions that is shown above in JSON format:

[
  {
    "type": "set",
    "_": {
      "key": "foo",
      "value": "bar"
    }
  },
  {
    "type": "invoke",
    "_": {
      "method": "http.get",
      "parameters": {
        "url": "https://example.com",
        "parameters": {
          "username": {
            "type": "get",
            "_": {
              "variable": "foo"
            }
          },
          "password": {
            "type": "get",
            "_": {
              "variable": "bar"
            }
          }
        }
      }
    }
  },
  {
    "type": "return",
    "_": {
      "type": "get",
      "_": {
        "variable": "http_response_body"
      }
    }
  }
]

Methods & Namespaces

Methods are different to instructions in the terms that RTEX can only expand its functionality by creating a library works as a plugin that can be imported by RTEX before executing the program.

Namespaces are used to avoid conflicting with already existing method names and to make things more organized, for example there could be a namespace called http which contains methods such as get, post, put, delete, etc. which can be invoked by the engine via the invoke instruction, methods are not the same as instructions as they are not executed in order, they are executed when they are invoked.

Note: This functionality is a WIP, more information will be added as it is implemented

License

RTEX Engine is licensed under the MIT License, see LICENSE for more information

Contributing

If you would like to contribute to RTEX Engine, please read CONTRIBUTING.md for more information