Version: v0.249.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 6 Imported by: 0


Sysl (WIP)

This package contains experimental code that operates on Sysl models. It seeks to:

  • Demonstrate how to use to work with Sysl models.
  • Replicate sysl's various commands in a more concise, functional style.
  • Introduce new capabilities such as relational modelling and data flow analysis.

Each script has an accompanying Markdown file describing the logic and output.


To keep things simple and consistent, all scripts currently work with the same model.sysl spec. This spec will evolve over time to contain the full range of Sysl features and patterns to stress test the scripts.

To run all the scripts at once, run:


To run a particular script, run make for it's output target. For example, to generate the SVG output of the data_diagram.arrai script, run:

make data_diagram.svg

For diagram targets (svg and png), make will use the script to produce the PlantUML output, then attempt to render it with a PlantUML server and save the result.

You can of course run the scripts directly as well. For example:

arrai run data_diagram.arrai > out/data_diagram.puml


Loading the model

Many of the scripts will start by importing the default model.sysl model like so:

let model = //{./load_model};

This actually loads the proto-encoded out/model.pb file, so if model.sysl is changed, out/model.pb must be regenerated like so:

sysl protobuf --mode=pb model.sysl > out/model.pb

If an extra command line arg is provided to arrai run, the load_model script treats it as a path to a .pb-encoded Sysl model to use instead.


To develop additional scripts, you're encouraged to use Visual Studio Code with the arrai extension.

To speed up the edit/refresh cycle, install the Save and Run extension and configure it with:

"saveAndRun": {
    "commands": [
            "match": "\\.arrai$",
            "cmd": "echo; arrai run ${file}",
            "useShortcut": false,
            "silent": false

This will make VS Code automatically run the script every time you save it (after printing a newline for clarity).

For more comprehensive testing, you can also run make on every save of every file in this directory.




This section is empty.


This section is empty.


func EvaluateBundle added in v0.238.0

func EvaluateBundle(bundle []byte, args ...string) (rel.Value, error)

RunBundle runs an bundle with the passed parameters set as //os.args[1:]. It help to pass Go's type parameters to arrai script explicitly.

func EvaluateScript

func EvaluateScript(arraiScript string, scriptParams ...interface{}) (rel.Value, error)

EvaluateScript evaluates script with passed parameters. It help to pass Go's type parameters to arrai script explicitly. TODO: will move it to arrai when it is ready.


type ExecutionError added in v0.249.0

type ExecutionError struct {
	Context  string
	Err      error
	ShortMsg string

ExecutionError encapsulates detailed error msgs from runtime.

func (ExecutionError) Error added in v0.249.0

func (e ExecutionError) Error() string

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL