Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.72 KB

DSLIntro.md

File metadata and controls

59 lines (42 loc) · 1.72 KB

Short DSL intro

The framework uses Domain Specific Language (DSL) to describe the system model. The DSL is based on Python 3 programming language. The following assumes basic understanding of the Python language.

DSL essentials

Consider the following very simple model called "Basic a". The model is in file samples/basic-a/system.py.

from tcsfw.main import Builder, TLS

system = Builder.new("Basic A")
device = system.device()
backend = system.backend().serve()
app = system.mobile()

device >> backend / TLS
app >> backend / TLS

The model building start with call to Builder.new, which takes the name of the system as argument, and returns to system object. The system comprises IoT device, backend service, and a mobile application, called together network nodes. The device and the application connect to the backend using TLS-protected connections.

Graphical view

A visual representation of a model requires placing the network nodes into canvas. The positions are controlled using DSL, like below.

system.visualize().place(
    "D   A",
    "  B  ",
) .where({
    "D": device,
    "B": backend,
    "A": app
})

The letters "A", "B", and "C" stand for the application, backend, and device. Thei positions are determined in the place method.

Claims

Claims are made for the model and verified by tool outputs. Claims are still very unmature concept. The description of the claims also employs a DSL, but that is very much unfinalized at the moment.

DSL reference

The interface code for the DSL is in Python module tcsfw.main. DSLs can use definitions from tcsfw.basics, as well. The source code in these files provides for the authorative reference code.