Subway
The Subway language attempts to mimic the workings of a railway system in order to produce a program. It's unique in the it has the potential for some paralleled computation in that multiple cars may be running on the "line" simultaneously.
Language Specifications
Code is written in the form of a continuous "track". Each "train" on the track is a stack, and each "car" is a stack element. There is a global accumulator, referred to as the "station". The station determines how the data in the last car (the top stack element) is modified. Cars may be connected or disconnected (pushed and popped) and start as empty.
Only a positive number of people may be in each car, however, negative numbers are representable as the value of a car is a normalised value of the number of people on the car. A car has 2^16 - 1 seats (a 16-bit binary value) and the value is normalised by 2^15 - 1. . Thus the value of a car is shown by:
(num people) - (2^15 - 1)
Which means the largest value is "32768" and the smallest is "-32767".
Up to four trains may be on the track at any given time. They are defined at different starting points.
Each train moves in a direction along the track given by an integer.
0 Right 1 Up 2 Left 3 Down
The direction can be changed during execution when a directional or conditional instruction is encountered.
> Right ^ Up < Left V Down ~ Up if last_car is empty, Otherwise Down (ignored if moving up/down) : Right if last_car is empty, Otherwise Left (ignored if moving left/right)
Cars may be connected or disconnected using the push and pop instructions
. Connects a new car with 32767 passengers "push(32767);" , Passengers in the last car replace the passengers in the station and the car is disconnected "ST = pop();"
There are four arithmetic instructions
+ Addition (last_car = last_car + station) - Subtraction (last_car = last_car - station) * Multiplication (last_car = last_car * station) / Division (last_car = last_car / station)
A constant hexadecimal digit c = [0,A] sets the numbers of passengers in the station to 2^c. Any other constant, non-instruction symbol sets the station to zero.
Input/Output is possible
$ Input (station = stdin) @ Output (stdout = station)
And finally the starting/terminating points and empty track may be defined with
w Starting point for train0 x Starting point for train1 y Starting point for train2 z Starting point for train3 S Termination point = Empty track
Examples
A simple program which takes two numbers from user input, adds them together and then prints them.
V=< w.o*.$+^ + S >=~==< >,@^