Graphical Atoms - Gratoms

Graphical Atoms are the lowest level graphical units that can edited by an editor.

For lack of a better term, I will use the word gratom to denote graphics atoms.

Editor Basic Operations

An editor can create various gratoms:

The editor does not know what it is editing.  The editor simply creates gratoms and allows the user to edit them.

Understanding what is on a diagram is left to later passes in the chain.


For an analogy, imagine a generic programming editor (emacs, vim, vscode, etc.).

The generic programming editor allows one to create and edit text (only).

It does not "know" what programming language it is editing.

It only knows a few basic rules:

A text-only programming editor creates grids of non-overlapping bitmap glyphs (called characters).

A more general editor, as described here can:





Straight Line

Curvy Line


Maybe the editor is just an SVG editor?

We need to use only a subset of SVG.  

We could write a routine that strips out all of the unwanted parts of SVG.

We could write a checker routine that checks that the stripped-down SVG diagram follows certain rules.  Such a checker is given the fancy name "parser" in traditional compiler lore.  A parser checks that the tokens follow certain rules.  In fancy compiler terminology: the parser checks that the tokens make up well-formed phrases in the language (DSL/PSL, in this case). 

Parsing is not contained in the editor proper.  Attempts at putting a lot of smarts into the editor were tried and failed.  Such editors - "structured editors" - were too complicated to maintain.  It was always better to put the parser in a separate pass.   Such structured editors also tried to deal with the conundrum of ill-formed code - some editors would not let you save an unfinished piece of code.  The user should be able to create garbage files using the editor, as long as the parser complains when fed garbage.  Let the editor edit, the parser parse, etc.