Mornington Crescent

Mornington Crescent, named after Mornington Crescent tube station in London and invented by Timwi in 2013 as somewhat of a tribute to the game of Mornington Crescent, is an esoteric programming language in which the data pointer moves through the London Underground by traveling by tube from station to station, starting and ending at Mornington Crescent.

Syntax
Mornington Crescent programs consist of a series of transitions from the current tube station to another, using one of the tube lines available at the current station. For example:

Take Northern Line to Leicester Square Take Piccadilly Line to King's Cross St. Pancras Take Circle Line to Westminster

etc.

Only lines matching  are valid, and the capturing groups must match a valid tube line name and tube station name, respectively.

An optional extra newline at the end of the program is acceptable.

Environment

 * During execution, every tube station on the London Underground has a current value, which is either an arbitrary-size integer or a string. Unless otherwise noted below, every station’s value starts out as a string containing that station’s name, for example Waterloo starts out with the value.
 * There is an accumulator which is also either an arbitrary-size integer or a string. This starts out with the contents of STDIN as a string.
 * The data pointer points at a current station. Execution begins at Mornington Crescent.
 * There is also a “jumpstack”, a stack of program locations, which is initially empty.

Valid Mornington Crescent programs must end at Mornington Crescent tube station. If execution moves beyond the last instruction in the program and that instruction does not validly take the data pointer to Mornington Crescent, a runtime error occurs.

Execution
Each instruction is executed as follows:


 * If the specified line or tube station doesn’t exist, or the line doesn’t connect the current station with the destination, a runtime error occurs.
 * Otherwise:
 * the data pointer is moved to the destination station;
 * the accumulator and the destination station’s value are swapped.

For example, if the first instruction in the program is

Take Northern Line to Leicester Square

then Leicester Square’s value becomes the string read from STDIN and the accumulator’s value becomes.

However, some of the stations have special behaviour as described below.

Computational class
Likely Turing complete because strings and integers can be any size and the jumpstack allows arbitrarily nested flow control. Not proven, however.

Forward compatibility
As the validity and the semantics of a program depend on the structure of the London underground system, which is administered by London Underground Ltd, a subsidiary of Transport for London, who are likely unaware of the existence of this programming language, its future compatibility is uncertain. Programs may become invalid or subtly wrong as the transport company expands or retires some of the network, reroutes lines or renames stations. Features may be removed with no prior consultation with the programming community. For all we know, Mornington Crescent itself may at some point be closed, at which point this programming language will cease to exist.

Hello, World!
This program was written by Martin Büttner and is only half the length of the language creator’s original version.

Take Northern Line to Hendon Central Take Northern Line to Bank Take Northern Line to Bank Take District Line to Gunnersbury Take District Line to Victoria Take Victoria Line to Seven Sisters Take Victoria Line to Victoria Take Victoria Line to Victoria Take District Line to Bank Take District Line to Hammersmith Take District Line to Cannon Street Take District Line to Hammersmith Take District Line to Cannon Street Take District Line to Bank Take District Line to Hammersmith Take District Line to Upminster Take District Line to Hammersmith Take District Line to Upminster Take District Line to Gunnersbury Take District Line to Paddington Take District Line to Acton Town Take Piccadilly Line to Holloway Road Take Piccadilly Line to Acton Town Take Piccadilly Line to Acton Town Take District Line to Gunnersbury Take District Line to Hammersmith Take District Line to Notting Hill Gate Take District Line to Upminster Take District Line to Notting Hill Gate Take District Line to Upminster Take District Line to Victoria Take Victoria Line to Seven Sisters Take Victoria Line to Victoria Take Victoria Line to Victoria Take District Line to Upminster Take District Line to Gunnersbury Take District Line to Mile End Take District Line to Hammersmith Take District Line to Notting Hill Gate Take District Line to Upminster Take District Line to Upminster Take District Line to Mile End Take District Line to Paddington Take District Line to Paddington Take District Line to Acton Town Take Piccadilly Line to Heathrow Terminals 1, 2, 3 Take Piccadilly Line to Holborn Take Central Line to Holborn Take Central Line to Mile End Take District Line to Upminster Take District Line to Hammersmith Take District Line to Upminster Take District Line to Barking Take District Line to Hammersmith Take District Line to Upminster Take District Line to Gunnersbury Take District Line to Barking Take District Line to Gunnersbury Take District Line to Paddington Take District Line to Paddington Take Circle Line to Wood Lane Take Circle Line to Victoria Take Circle Line to Victoria Take District Line to Gunnersbury Take District Line to Hammersmith Take District Line to Upminster Take District Line to Gunnersbury Take District Line to Paddington Take District Line to Paddington Take District Line to Mile End Take Central Line to Fairlop Take Central Line to Mile End Take District Line to Barking Take District Line to Upminster Take District Line to Upminster Take District Line to Hammersmith Take District Line to Notting Hill Gate Take District Line to Upminster Take District Line to Mile End Take District Line to Gunnersbury Take District Line to Paddington Take District Line to Paddington Take District Line to Hammersmith Take District Line to Mile End Take District Line to Richmond Take District Line to Mile End Take District Line to Paddington Take District Line to Paddington Take District Line to Richmond Take District Line to Bank Take District Line to Hammersmith Take District Line to Upminster Take District Line to Stepney Green Take District Line to Hammersmith Take District Line to Stepney Green Take District Line to Upney Take District Line to Notting Hill Gate Take District Line to Notting Hill Gate Take District Line to Notting Hill Gate Take District Line to Upminster Take District Line to Upney Take District Line to Upminster Take District Line to Bank Take Circle Line to Bank Take Northern Line to Charing Cross Take Bakerloo Line to Charing Cross Take Bakerloo Line to Paddington Take Circle Line to Bank Take Circle Line to Bank Take Northern Line to Mornington Crescent

Esoteric IDE
Interpreter and debugger for many esoteric languages (including Mornington Crescent), written by the author of Mornington Crescent. The sources can be found at GitHub.

Esoterpret
Multi-language interpreter written in Python, as of 2015-10-06 only supporting Mornington Crescent. Open Source and available at GitHub.