Overview

Arrowgrams is a diagram transpiler.

A diagram is drawn using Draw.io then,

  1. transpiled into a JSON graph
  2. run as an app.

Arrowgrams diagrams are box-and-arrow diagrams that use a small subset of SVG. The diagrams are exported to SVG format.

diagramdiagram compiler(Arrowgrams)JSON(graph)runtime

An example diagram can be found in
helloworld.

This essay is intended to document the rewrite of the type transpiler using the SCN Workbench. I skip (elide) the details of the Arrowgrams system.

The type transpiler is used for building the Arrowgrams runtime.

I will drill down into the runtime (only) in this essay:

Layer 1

The runtime consists of two portions

  1. code that was written manually
  2. code that was generated automatically.

ESA means “encapsulated software assets”, i.e. software components.

An ESA is either

  1. a leaf node consisting of code (in some language)
  2. a recursive graph of ESA components.

In the current version of Arrowgrams, ESA leaves are written in CL (Common Lisp) and recursive graphs are saved as JSON files.

runtimeESACodeManuallyWrittendiagramdiagram compiler(Arrowgrams)JSON(graph)

Layer 2

The automatically generated code portion of the runtime is transpiled using

  1. A specification of the runtime, esa.dasl
  2. A specification of the types used within the runtime exprtypes.dsl

This note drills down onto (2) exprtypes.dsl and shows how to replace it using the SCN workbench

runtimetranspiler(esa.dsl to esa.lisp)ESACodeManuallyWrittendiagramdiagram compiler(Arrowgrams)JSON(graph)esa.dslexprdatatypes.json

Layer 3

The exprtypes transpiler is built using

  1. A type specification
  2. A pipeline of 4 passes of code (written in PASM)
  3. A tree walker.
pass 0transpiler(esa.dsl to esa.lisp)dsl0.pasmexprdatatypes.lispmanual codepasmengineintermediatedata
pass 1
pass 1
dsl1.pasmexprdatatypes.lispmanual codepasmengineintermediatedatapass 2dsl2.pasmexprdatatypes.lispmanual codepasmengineintermediatedatapass 3dsl3.pasmexprdatatypes.lispmanual codepasmengineintermediatedatatree walker

Types

The type system used by the transpiler is written as a specification exprtypes.dsl.

The type specification produces two files

  1. exprtypes.lisp
  2. exprtypes.json

The JSON file is used to initialized the runtime system, while the lisp file is used as part of the code.

exprdatatypes.lispexprdatatypes.jsonexprtypes.dsltypetranspiler

ASC Example

An alternate version of the type transpiler is found in exprtypeslisp.html.

The type specification (aka a type SCN, aka a type DSL) is discussed elsewhere.

exprdatatypes.lispexprdatatypes.jsonexprtypes.dsltypetranspilerGoal: rebuild "type transpiler" using SCN workbench