Simple flowchart diagrams. Inspired by DRAKON.
- no ambiguity in produced flowcharts
- simple flowchart syntax
- code easy to build and run
- connections never cross
- connections are comprised only of horizontal and vertical lines
- default direction: top-to-bottom
- deterministic: input A will always produce output B
Wyvern uses plain text files as input, extensions are not relevant. You can copy and paste the examples below to individual files with no alterations.
| code | rendered flowchart |
|
|
|
|
|
|
|
|
|
start/end terminator- consecutively, start and end blocks of any diagram- code: not represented in the code
action block- basic building block of any diagram, illustrating an individual action- code:
[action id] "caption"
- code:
fork block- a yes/no questions starting two branching paths:yes- default direction - down, the preferred outcomeno- the alternative outcome, not as optimal. The no branch can optionally end with an id of another block on the fork skewer forming a gamma connection.- code:
[fork id] "caption" { ... yes branch ... } { ... no branch ... [gamma connection id] }gamma connection- line connecting no branch with another block placed on fork's skewer - it can either be the fork id itself or a block preceding the fork, provided that would not cause any connections to clash.skewer- vertical line on which blocks are placed in linear progression. Each fork block has the ability to introduce an alternative/no path which eventually merges back into the skewer on which their fork block is placed. The merging point can be placed in three different locations:- immediately after the fork block from which it originates
- the fork block from which it originates forming a loop
- before the fork block from which it originates forming a loop - the thing to note here is these connections are not restricted (yet) and it is possible to formulate a loop where connections cross. This is going to be addressed in future releases of the code as lines should never cross and the library should be able to enforce it by validation or syntax.
headline block- a block serving as an identifier of a skewer grouping a sequence of blocks.address block- a block concluding a skewer grouping a sequence of blocks and containing the identifier of a headline block which we should visit next when following the flowchart.- code:
[headline id] "caption" { ... skewer blocks ... [address id] ... id of another headline }
- code:
primitive diagram- a diagram which only leverages blocks of type:start/end terminatoraction blockfork block
silhouette diagram- a diagram which contains the same types of block as theprimitive diagrambut which can also containheadline blocksandaddress block.
In primitive diagrams, blocks are arranged in a linear fashion: action C follows action B and action B follows action A (think 1D list of blocks).
In silhouette diagrams, headline blocks and address blocks divide the diagrams into individual skewers/smaller tasks that can be represented as a sequence of blocks (think 2D list of blocks).
- prerequisites:
- ghc
- cabal
- alex
- happy
- hlint
- ormolu
For local installation, ghcup is the most reasonable choice on amd64 machines.
Simply execute:
./build.shHaving compiled the project, simply execute:
cabal run wyvern-diagrams -- -i "./diagram.txt" -o "./diagram.svg"Or, to see some sample diagrams, execute:
./run.shHaving compiled the project, simply execute:
./test.shcabal repl wyvern --repl-options="-fbreak-on-error -fbreak-on-exception":load app/Main:break Blocks 365:main -i "./diagrams/simple-diagram-1.txt" -o "./diagrams/simple-diagram-1.svg"
DRAKON is wyvern's big brother - more complex, steeper learning curve, more terms, more rules.
