Home Resources Documentation Examples Language GitHub

The language

In the following grammar definition terminals are in bold while non terminals are in italic. The ( and ) parenthesis are used to indicate a sequence of tokens while the characters ?, * and + after a token indicate that the token can be optional, it can match zero or more times and can match one or more times respectively. The vertical character | indicate possible alternatives. Strings inside single quotes indicate literal matches while single quotes preceded by r indicate regex matches.
diagram : 'diagram' identifier attrList? elements
elements : '{' element* '}'
element : node
| edge
| group
node : provider '.' id identifier attrList? ';'
edge : identifier (link identifier)+ attrList? ';'
group : 'group' identifier attrList? elements
attrList : '[' attribute (',' attribute)* ']'
attribute : id '=' identifier
link : '->' | '<->' | '=>' | '<=>'
identifier : id | quotedId
id : r'([a-zA-Z][a-zA-Z0-9_\-]*|[-]?[0-9]+(\.[0-9]*)?)'
quotedId : r'"[a-zA-Z0-9_\- ,().]*"'

diagram

'diagram' diagram identifier attrList elements

identifier

id ([a-zA-Z][a-zA-Z0-9_\-]*|[-]?[0-9]+(\.[0-9]*)?) quotedId "[a-zA-Z0-9_\- ,().\/#]*"

elements

'{' { element '}' }

element

node edge group

node

provider (aws|k8s|azure|gcp|generic|devicon) '.' \. id ([a-zA-Z][a-zA-Z0-9_\-]*|[-]?[0-9]+(\.[0-9]*)?) identifier attrList ';' ;

edge

identifier link identifier attrList ';' ;

group

'group' group identifier attrList elements

attrList

'[' \[ attribute attribute ',' , attribute attribute ']' ]

attribute

id ([a-zA-Z][a-zA-Z0-9_\-]*|[-]?[0-9]+(\.[0-9]*)?) '=' = identifier

link

'->' -> '<->' <-> '=>' => '<=>' <=>