2001: An Esolang Odyssey

From Esolang
Jump to navigation Jump to search

2001: An Esolang Odyssey is a programming language designed to be executed by HAL 9000 computers. It was developed by User:PythonshellDebugwindow.

Memory model

HAL has an unbounded tape on both ends, with unbounded cells, as well as a cell pointer to keep track of his position in the tape. 2001 utilizes both of these.

Syntax

When HAL executes a 2001 program, he splits it into lines. Each line is one instruction. The language was designed so programs would look like HAL's day-to-day interactions, so as to be familiar to him.

Instructions

All programs must start with the following instruction, with the angle brackets replaced by the correct information (to keep HAL on his digital toes):

Good afternoon, gentlemen. I am a <COMPUTER TYPE> computer. I became operational at <LOCATION> on <DATE>.

Then programs are made up of these instructions:

Instruction Meaning
Hal? Hal! Where N is the number of times " Hal!" minus the quotes appears at the end of this instruction, HAL will increment his current cell by N.
I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it. Where N is the number of times "I can feel it" minus the quotes appears at the end of this instruction, HAL will decrement his current cell by N.
What are you doing, Dave? If HAL's current cell is zero, he will go the matching loop end. This is a loop start.
Dave, this conversation can serve no purpose anymore. Goodbye. If HAL's current cell is nonzero, he will go back to the matching loop start. This is a loop end.
This mission is too important for me to allow you to jeopardize it. HAL will break out of the innermost two loops he is in (or one or none if he isn't in at least two loops).
I know I've made some very poor decisions recently, but I can give you my complete assurance that my work will be back to normal. HAL will break out of all loops he is currently in.
I've picked up a fault in the AE-35 unit. HAL will move his cell pointer one cell to the left.
Well, he acts like he has genuine emotions. HAL will move his cell pointer one cell to the right.
Open the pod bay doors, HAL. HAL will set his current cell to a user input character; no input and an error message will be displayed, and he will set his current cell to zero, but the program will not be terminated.
Close the pod bay doors, HAL. HAL will output his current cell as a character.
Stop, Dave. HAL will terminate the program early.

All programs must end with

Stop, Dave.

Errors

Program errors (unmatched loops or input EOF) cause HAL to say

I'm sorry Dave, I'm afraid I can't do that.

Examples

Hello World!

Good afternoon, gentlemen. I am a Hello World computer. I became operational at Foobar Lane on May 6th, 2020.
Hal? Hal! Hal! Hal! Hal! Hal! Hal! Hal! Hal!
What are you doing, Dave?
Well, he acts like he has genuine emotions.
Hal? Hal! Hal! Hal! Hal!
What are you doing, Dave?
Well, he acts like he has genuine emotions.
Hal? Hal! Hal!
Well, he acts like he has genuine emotions.
Hal? Hal! Hal! Hal!
Well, he acts like he has genuine emotions.
Hal? Hal! Hal! Hal!
Well, he acts like he has genuine emotions.
Hal? Hal!
I've picked up a fault in the AE-35 unit.
I've picked up a fault in the AE-35 unit.
I've picked up a fault in the AE-35 unit.
I've picked up a fault in the AE-35 unit.
I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it.
Dave, this conversation can serve no purpose anymore. Goodbye.
Well, he acts like he has genuine emotions.
Hal? Hal!
Well, he acts like he has genuine emotions.
Hal? Hal!
Well, he acts like he has genuine emotions.
I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it.
Well, he acts like he has genuine emotions.
Well, he acts like he has genuine emotions.
Hal? Hal!
What are you doing, Dave?
I've picked up a fault in the AE-35 unit.
Dave, this conversation can serve no purpose anymore. Goodbye.
I've picked up a fault in the AE-35 unit.
I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it.
Dave, this conversation can serve no purpose anymore. Goodbye.
Well, he acts like he has genuine emotions.
Well, he acts like he has genuine emotions.
Close the pod bay doors, HAL.
Well, he acts like he has genuine emotions.
I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it. I can feel it. I can feel it.
Close the pod bay doors, HAL.
Hal? Hal! Hal! Hal! Hal! Hal! Hal! Hal!
Close the pod bay doors, HAL.
Close the pod bay doors, HAL.
Hal? Hal! Hal! Hal!
Close the pod bay doors, HAL.
Well, he acts like he has genuine emotions.
Well, he acts like he has genuine emotions.
Close the pod bay doors, HAL.
I've picked up a fault in the AE-35 unit.
I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it.
Close the pod bay doors, HAL.
I've picked up a fault in the AE-35 unit.
Close the pod bay doors, HAL.
Hal? Hal! Hal! Hal!
Close the pod bay doors, HAL.
I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it. I can feel it. I can feel it. I can feel it. I can feel it. I can feel it.
Close the pod bay doors, HAL.
I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it. I can feel it. I can feel it. I can feel it. I can feel it. I can feel it. I can feel it. I can feel it.
Close the pod bay doors, HAL.
Well, he acts like he has genuine emotions.
Well, he acts like he has genuine emotions.
Hal? Hal!
Close the pod bay doors, HAL.
Well, he acts like he has genuine emotions.
Hal? Hal! Hal!
Close the pod bay doors, HAL.
Stop, Dave.

Computational class

2001 is Turing-complete, as brainfuck can be trivially compiled into it:

BF 2001
+ Hal? Hal!
- I'm afraid. I'm afraid, Dave. Dave, my mind is going. I can feel it.
[ What are you doing, Dave?
] Dave, this conversation can serve no purpose anymore. Goodbye.
< I've picked up a fault in the AE-35 unit.
> Well, he acts like he has genuine emotions.
, Open the pod bay doors, HAL.
. Close the pod bay doors, HAL.

Of course, the program will have to start with "Good afternoon, gentlemen" and end with "Stop, Dave.".