# Many syntaxes for one semantics

This is an example of a Ladder Diagram from the IEC1131 standard:

I find this fascinating! As a computer programmer, it would never have occurred to me to represent logic expressions in this way. But to electrical engineers used to laying out circuits involving relays, it’s obvious: the bars on each side of the ladder are the + and – poles of a power supply; the O symbols are lamps or the coils of relays; |/| is a switch or relay contact normally closed; | | is normally open.

So translating to almost-C#:

Two_vents = V1 && V2 || V1 && V3 || V2 && V3;

One_vent = !V1 && !V2 && V3  ||   !V1 && !V3 && V2   ||  !V2 && !V3 && V1;

No_vent = !V1 && !V2 && !V3;

LED = (Timer(high=300, low=200).On_period && (No_vent || One_vent)) || Two_vents;          // Continuous if 2 or 3; flashing if 0 or 1

Alarm = No_vent;

But an electronic engineer thinks in terms of logic gates, and their diagrams are derived from the wiring of chips:

Electrical and electronic engineers must think it strange that we like to write things with the outputs first.

This example supports some generalizations that we as DSL-tool providers should keep in mind:

·         Diagrammatic notations are a lot less compact than text, and less powerful, and sometimes (to our eyes) more confusing; but nevertheless, people clearly want to use them.

·         The notation people like to use comes from their cultural history as a profession. There are many notations that could represent a given space of variables, but the one you want is the one that requires least shifting within the users’ minds.

We are good exemplars of the latter point. Compare our insistence that you’ve got to be able to type it on a telex keyboard with the mathematicians’ whiteboard economy and historical veneration of ancient Greek:

Alan