Sailing By

From Esolang
Jump to navigation Jump to search
Sailing By
Paradigm(s) imperative, low-level, pseudonatural, thematic
Designed by User:Ecatmur
Appeared in 2022
Type system untyped
Memory system cell-based
Dimensions one-dimensional
Computational class Turing complete
Reference implementation
Dialects standard, extended
Influenced by Mornington Crescent, Shakespeare
File extension(s) .dat

And now the Shipping Forecast, issued by the Met Office on behalf of the Maritime and Coastguard Agency at 0645 today.

Sailing By is an esoteric language intended to resemble the Shipping Forecast broadcast on BBC Radio 4.

Example (Hello, world!)

And now the Shipping Forecast, issued by the Met Office on behalf of the Maritime and Coastguard Agency at 0000 today.
There are warnings of gales in North Utsire, South Utsire, Forties, Cromarty, Dogger, Fisher, German Bight, Humber, and Thames.
The general synopsis at 0300.
High Thames 1023 losing its identity by 0000 tomorrow.
The area forecasts for the next 24 hours.
Viking. Variable 7. Slight. Rain. Good.
North Utsire, South Utsire, Forties. Variable storm 10. Slight. Rain. Good.
Cromarty. Variable violent storm 11. Slight. Rain. Good.
Forth. Variable 4. Slight. Rain. Good.
Tyne. Variable 3. Slight. Rain. Good.
Dogger, Fisher, German Bight. Variable violent storm 11. Slight. Rain. Good.
Humber, Thames. Variable storm 10. Slight. Rain. Good.
Dover. Variable 3. Slight. Rain. Good.
Wight. Variable 1. Slight. Rain. Good.
Portland, Plymouth, Biscay, FitzRoy, Sole, Lundy, Fastnet, Irish Sea, Shannon, Rockall, Malin, Hebrides, Bailey, Fair Isle, Faeroes, Southeast Iceland. Calm. Smooth. Clear. Good.

And now the Shipping Forecast, issued by the Met Office on behalf of the Maritime and Coastguard Agency at 0100 today.
There are warnings of gales in South Utsire, Forties, Dogger, and Humber.
The general synopsis at 0400.
High Thames 1023 losing its identity by 0200.
The area forecasts for the next 24 hours.
Viking. Variable 2. Slight. Rain. Good.
North Utsire. Variable 1. Slight. Rain. Good.
South Utsire, Forties. Variable gale 8. Slight. Rain. Good.
Cromarty. Variable 1. Slight. Rain. Good.
Forth. Variable 4. Slight. Rain. Good.
Tyne. Variable 2. Slight. Rain. Good.
Dogger. Variable severe gale 9. Slight. Rain. Good.
Fisher. Variable 1. Slight. Rain. Good.
German Bight. Variable 4. Slight. Rain. Good.
Humber. Variable gale 8. Slight. Rain. Good.
Thames. Calm. Smooth. Clear. Good.
Dover. Variable 3. Slight. Rain. Good.
Wight, Portland, Plymouth, Biscay, FitzRoy, Sole, Lundy, Fastnet, Irish Sea, Shannon, Rockall, Malin, Hebrides, Bailey, Fair Isle, Faeroes, Southeast Iceland. Calm. Smooth. Clear. Good.

And now the Shipping Forecast, issued by the Met Office on behalf of the Maritime and Coastguard Agency at 0200 today.
There are no gale warnings in effect.
The general synopsis at 0500.
Low Thames 1003 losing its identity by 0300.
The area forecasts for the next 24 hours.
Viking, North Utsire, South Utsire, Forties, Cromarty, Forth, Tyne, Dogger, Fisher, German Bight, Humber, Thames, Dover, Wight. Calm. Smooth. Clear. Poor.
Portland, Plymouth, Biscay, FitzRoy, Sole, Lundy, Fastnet, Irish Sea, Shannon, Rockall, Malin, Hebrides, Bailey, Fair Isle, Faeroes, Southeast Iceland. Calm. Smooth. Clear. Good.

Syntax

A Sailing By program is a sequence of forecasts, separated by blank lines:

Each forecast begins with an introduction, And now the Shipping Forecast, issued by the Met Office on behalf of the Maritime and Coastguard Agency at <time> today.; the time of issue of the forecast is its label, so each program can have up to 3600 different labels, but they can be reused within a program to allow it to have more than 3600 forecasts. In simple programs, it is usual to list the forecasts in ascending order of time of issue.

Following the introduction is the list of chart areas (in the correct order) with gale warnings in effect viz. There are no gale warnings in effect., There are warnings of gales in <areas>., or There are warnings of gales in all areas [except <areas>].; this has no semantic effect but is required to list exactly those areas with gale force or above winds at any time in the following area forecasts, so it's easiest to fill this in afterwards. Use the Oxford comma before and if more than 2 chart areas have gale warnings.

Next, write the general synopsis, with at least one high or low pressure area, again listed in order of the originating chart area. The format is:

(High|Low) <area-1> <pressure-1> (expected <area-2> <pressure-2>|losing its identity) by <time> [tomorrow].

Highs must be at least 1013 (millibar), and lows at most 1013.

Finally, the area forecasts, with format:

<areas>. <wind>. <surface>. <precipitation>. <visibility>. [<icing>.]

Again, chart areas must be listed in the correct order, but here comma-separated without and; forecasts may be combined, with exceptions.

Every chart area must be listed, except that Trafalgar may be omitted, in which case it is assumed to have default conditions of Calm. Smooth. Clear. Good. (and no icing).

Each element of an area forecast may have exceptions, which must be listed within that element in chart order. The general syntax (recursive) for an element is (<individual-element>|<element>, <element> in <area>). The exceptional area must be one of those at the start of the line.

If a single area is listed, it may have sub-area exceptions identified by compass directions. This is necessary when sailing in certain directions from Forties, German Bight, and Sole (see below), and into coastal waters in Extended Sailing By.

Each forecast covers 3 time periods: at first (aka imminent), soon and later; if these are omitted, the individual element forecast (including exceptions) is understood to continue through the remainder of the forecast. Changes are prefixed by becoming for those taking effect soon, and then for those taking effect later:

<individual-element-forecast> [at first] [becoming <individual-element-forecast> [soon]] [then <individual-element-forecast> [later]]
<individual-element-forecast> soon [then <individual-element-forecast> [later]]
<individual-element-forecast> later

If the element forecast is silent on a particular time period, the default conditions are understood to obtain. For example, Sleet soon. implies clear at other times.

Wind forecasts have a direction (on the 8-point compass scale, variable, or cyclonic), a strength on the Beaufort scale, where 0 is written calm and 8 and above are preceded by their names. The direction is omitted for calm. Uniquely, when wind changes direction between points on the compass scale, except between diametrically opposed points, the change is instead prefixed veering (for clockwise changes) or backing for anticlockwise changes. If this makes the time of change ambiguous, this is resolved in favor of soon. Remember that wind direction is that which the wind is coming from, so opposite the direction of travel downwind!

Sea surface can be smooth, slight, moderate, rough or very rough.

Precipitation can be clear, showers, rain, thundery rain, wintry showers, sleet, snow showers, snow, ...etc.

Visibility can be good, moderate, poor or fog.

Icing can be light, moderate or severe, with icing included after the very first instance; if it stops the time can be written explicitly, e.g. Light icing at first then severe later, moderate soon then moderate in Rockall..

In Extended Sailing By the area forecasts are followed by the coastal weather station report and then the inshore waters forecast.

Semantics

File:UK shipping forecast zones.png
Map of Sea Areas and Coastal Weather Stations referred to in the Shipping Forecast

Chart areas contain any (natural) number of ships, all initially zero.

The chart areas are connected hydrographically; for example, from German Bight sailing north one passes through Fisher, South Utsire and finishes at North Utsire. For simplicity's sake, for each pair of adjacent areas there is only one direction, and its opposite serves for the reverse voyage. Nonexistent bearings, e.g. W from Rockall, SW from Viking, or N from Portland, are detected and rejected at parse time, although note that the latter direction is valid in Extended Sailing By, accessing coastal waters. In the three ambiguous cases (W from Forties, W from German Bight, and N from Sole), the forecast must cover a single area with sub-area exceptions, for example Forties. Calm, east gale 8 in north. Slight. Rain. Good..

Execution begins at the first forecast and proceeds in order, cycling back to the start at the end of the program. For each forecast, the area forecasts may be executed in turn up to 3 times, beginning at the time of issue (for the imminent conditions) and proceeding to +6 and +12 hours (soon and later), depending on whether the general synopsis transfers execution to a different forecast. Prior to and after each execution (so up to 4 times in total), the time of the general synopsis is checked, and if it is in effect (its time is not after the current time) the pressure areas are checked for (conditional) jumps:

Pressure area
Low losing its identity area-1 == 1013 - pressure-1
Low pressure-1 > pressure-2 (deepening) area-1 >= area-2
Low pressure-1 < pressure-2 (easing) area-1 <= area-2
High losing its identity area-1 != pressure-1 - 1013
High pressure-1 < pressure-2 (rising) area-1 > area-2
High pressure-1 > pressure-2 (falling) area-1 < area-2

If a conditional jump is satisfied, the remainder of the program (by default) or the whole program (for tomorrow) is searched for a forecast with the appropriate time; if one is found, execution is immediately transferred there, otherwise the program halts (2359 is a common time to use for halting).

Otherwise, each chart area is visited in strict order.

Each operation affects at most two chart areas; the chart area being visited, and that reached by sailing downwind, if any.

The wind speed determines the number of areas passed through, except for variable where it instead denotes a constant, and cyclonic where it denotes repeated self-application (mainly allowing exponentiation by repeated application of the multiplication operation).

The sea surface determines the direction of the operation:

Sea surface
Smooth nop
Slight set dest := op(src)
Moderate reverse set src := op(dest)
Rough swap src, dest := dest, op(src)
Very rough reverse swap src, dest := op(dest), src

The precipitation determines arithmetic operations:

Precipitation
clear none
showers modulus
rain add also logical or
thundery rain and (bitwise)
wintry showers or (bitwise)
sleet divide (integer)
snow showers xor (bitwise)
snow subtract (saturating at 0) subtract from 1 for logical not
hail multiply also logical and

Visibility performs I/O:

Visibility
Good none
Moderate read a character
Poor write a character
Fog ??

Icing is as yet undetermined.

More examples

Truth machine

And now the Shipping Forecast, issued by the Met Office on behalf of the Maritime and Coastguard Agency at 0000 today.
There are no gale warnings in effect.
The general synopsis at 0900.
Low Bailey 964 losing its identity by 0200.
High Rockall 1061 losing its identity by 2300.
The area forecasts for the next 24 hours.
Viking, North Utsire, South Utsire, Forties, Cromarty, Forth, Tyne, Dogger, Fisher, German Bight, Humber, Thames, Dover, Wight, Portland, Plymouth, Biscay, FitzRoy, Sole, Lundy, Fastnet, Irish Sea, Shannon, Rockall, Malin, Hebrides, Bailey, Fair Isle, Faeroes, Southeast Iceland. Calm, south 1 in Rockall. Smooth, slight in Rockall. Clear. Good, fog at first in Rockall.

And now the Shipping Forecast, issued by the Met Office on behalf of the Maritime and Coastguard Agency at 0200 today.
There are no gale warnings in effect.
The general synopsis at 0500.
Low Bailey 964 losing its identity by 0200 tomorrow.
The area forecasts for the next 24 hours.
Viking, North Utsire, South Utsire, Forties, Cromarty, Forth, Tyne, Dogger, Fisher, German Bight, Humber, Thames, Dover, Wight, Portland, Plymouth, Biscay, FitzRoy, Sole, Lundy, Fastnet, Irish Sea, Shannon, Rockall, Malin, Hebrides, Bailey, Fair Isle, Faeroes, Southeast Iceland. Calm. Smooth. Clear. Good, poor in Bailey.

Cat program

And now the Shipping Forecast, issued by the Met Office on behalf of the Maritime and Coastguard Agency at 0000 today.
There are no gale warnings in effect.
The general synopsis at 0300.
Low Rockall 1013 losing its identity by 2300.
The area forecasts for the next 24 hours.
Viking, North Utsire, South Utsire, Forties, Cromarty, Forth, Tyne, Dogger, Fisher, German Bight, Humber, Thames, Dover, Wight, Portland, Plymouth, Biscay, FitzRoy, Sole, Lundy, Fastnet, Irish Sea, Shannon, Rockall, Malin, Hebrides, Bailey, Fair Isle, Faeroes, Southeast Iceland. Calm. Smooth. Clear. Good, fog at first becoming poor soon then good later in Rockall.