Pidgin Syntax
Pidgin syntax is very simple. There are two basic ways of relating the entities (things/boxes) in your diagrams. They are generally not used at the same time but you can mix and match the two types in a single diagram too if you want to.
Basics
- Pidgin is currently case sensitive so
Objectis not the same asobject. (NB: I am probably going to change this soon.) - Entities must either be single words (e.g.
Entity), concatenated words (MyEntityormy_entity). You can also use speech marks if you want to use multiple words or punctuation marks, e.g."My Entity", and"IsTrue?"which can be handy in flowcharts. . - You can use singular or plural forms as you please, but they are considered different entities if you mix them (so
objectsis different toobject). - Pidgin has a basic syntax checker but it's not perfect and occasionally your graph may not render properly (or at all), without saying why.
- There are two types of comments. You can comment any line of code using
#as the first character on the line. You can also add comments to the diagram itself by using thecommentverb specifying first the relationship entity or flowchart step you're commenting, like this:Object comment "Some comment". You can use\nto make the comment break onto a new line if it's long.
1. Relationship Diagrams
Relationships are described with:
ThingOne relationship ThingTwo, or
ThingOne relationship cardinality ThingTwo
"Cardinality" just means how many, so you can optionally say things like this. E.g.
User has a Car
Car has many Wheel
Car has one SteeringWheel
Wheel has optional FancyHub
There are 11 main relationship verbs and each has their own style of arrow which can have a different tail, head and colour:
| Verb | Tail | Head | Colour |
|---|---|---|---|
| is | no decorator | arrow (solid) | red |
| sees | no decorator | arrow (solid) | green |
| extends | no decorator | arrow (solid) | green |
| updates | no decorator | arrow (solid) | blue |
| from | arrow (solid) | no decorator | red |
| has | no decorator | black | |
| uses | diamond (outline) | arrow (solid) | blue |
| controls | diamond (outline) | arrow (solid) | red |
| contains | diamond (solid) | arrow (solid) | blue |
| inherits | arrow (solid) | no decorator | red |
| association | no decorator | no decorator |
There are 4 main cardinalities which change the style of the relationship arrow(s):
| Cardinality | Tail | Head |
|---|---|---|
| many | crow's foot | |
| optional | circle (outline) | |
| one | T shape | |
| a | T shape |
2. Flowcharts
Flowcharts can be described very simply and quickly:
StepOne then StepTwo, or
StepOne then Decision (Nb: pidgin doesn't really distinguisgh between decisions and steps; a decision is just another type of step).
You can specify any condition following a decision like this:
Decision [optional condition] then StepWhatever
There are 2 words that pidgin considers to be flow actions:
| Word | Tail | Head | Colour |
|---|---|---|---|
| then | no decorator | arrow (solid) | blue |
| next | no decorator | arrow (solid) | blue |