TOD

From Esolang
Jump to: navigation, search

TOD (Time of Day) is a tape-based language designed by User:null in 2010. What its instructions do when executed change depending on the current time of day. The design goal was to make running Hello world take longer than compiling OpenOffice.org.

Instructions

  1. nop
  2. do

Execution

The pointer points to a cell in a right-infinite tape of bytes, initially all zero. The instructions in the program are loaded into memory, where each bit in the program corresponds to either nop (when 0) or do (when 1). The loaded instructions are then executed sequentially.

Whenever the nop instruction is encountered, one second is wasted, and execution continues on the next instruction as normal. Whenever the do instruction is encountered, it performs the operation corresponding to the current time of day in the following table.

Time of day Operation
Early Morning (sunrise to 8:00am) Increment cell at pointer
Morning (8:00am to 12pm) Move the pointer forward.
Afternoon (12pm to sunset) Move the pointer backward.
Snack (2pm-3pm) Decrement the cell at pointer
Night (sunset to sunrise) Output the byte at the pointer as ASCII.
Exactly on a transition (sunrise, sunset, 12pm, 2pm, 3pm) Input a byte and store it at the pointer as ASCII.
00:42:00 Skip next operation (do instruction) if current cell is 0
00:00:42 Jump forwards/backwards according to current cell value

Errors

The interpreter MUST report an error if the start time is not 00:00:00. All instructions MUST take one second. If this can not be guaranteed by the compiler execution SHOULD report an error.

Time Zones and related matters

The operator MAY supply a time zone to the interpreter to use. If none is supplied the interpreter MUST use UTC as its time zone. Sunset and Sunrise occur at 7:00:00 am and 7:00:00 pm respectively although an OCD programmer MAY as an extension to the language supply a table of the correct sunrise and sunset times.