Toronto

The Six: A Toronto Code Poem in Pascal

edit

Inspired by the classic 1990 Larry Wall poem "Black Perl", The Six is a valid, compilable Pascal program written to read like poetry while outputting a tribute to Toronto when executed.

The Code

edit
program The_Six;

var
  skyline, lake, fog, twilight: boolean;
  boroughs, streetcars, blocks, stops: integer;

procedure hum(city: string); begin writeln(city); end;
procedure ride(further: integer); begin blocks := blocks + further; end;
procedure gaze(lights: string); begin writeln(lights); end;
procedure belong; begin hum('...diversity our strength.'); halt; end;

begin
  skyline := true; lake := true;
  fog := false; twilight := not fog;
  blocks := 0; stops := 4;

  hum('where the lake meets the steel:');

  for boroughs := 1 to 3 do
  begin
    ride(boroughs);
    case boroughs of
      1: hum('  the CN Tower pierces the morning mist,');
      2: hum('  red streetcars spark along Queen and King,');
      3: hum('  autumn leaves drift through High Park.');
    end;
  end;

  if (skyline and lake) then
    gaze('ferries glide toward the quiet islands.');

  repeat
    stops := stops - 1;
    if stops = 3 then hum('past the stone arches of the Distillery,');
    if stops = 2 then hum('through the neon glow of Yonge and Dundas,');
    if stops = 1 then hum('up to the Scarborough Bluffs at dawn...');
  until (stops <= 0) or fog;

  while (skyline and twilight) do
  begin
    streetcars := streetcars + 1;
    if blocks > 0 then
    begin
      lake := true;
      belong;
    end;
  end;
end.
where the lake meets the steel:
  the CN Tower pierces the morning mist,
  red streetcars spark along Queen and King,
  autumn leaves drift through High Park.
ferries glide toward the quiet islands.
past the stone arches of the Distillery,
through the neon glow of Yonge and Dundas,
up to the Scarborough Bluffs at dawn...
...diversity our strength.