05
SEP
2007
Ever wondered what the programming language that runs a space shuttle looks like?
Below are a few pages of code from NASA’s high-level programming language “HAL/S”. A very sweet look at what was running some of the most sophisticated equipment known to man at the time.
Figure II-2 appears to be some sort of cron job, while the rest of the code is pretty straightforward. Enjoy!
HAL/S
HAL/S is a high-level programming language commissioned by NASA in the late 1960s to meet the real-time programming needs of the Agency. At the time, programs used on board spacecraft were either written in assembly languages or in interpreted languages. The former make programs difficult to write and maintain, and the latter are insufficiently robust and slow. Also, future systems were expected to be much larger and more complex, and cost would be moderated by the use of a high-level language.
GOAL
Below is some code from another high-level language “GOAL”. Notice they use GO TO! Tsk tsk.
GOAL is a high-level language that uses the terminology of test engineers to write tests and procedures to certify that a Shuttle vehicle is ready for launch. When the first automated preflight checkout programs were written in the mid-1960s, Marshall Space Flight Center originated ATOLL, a special high-level language for use in preparing test procedures. GOAL superseded that language in the early 1970s.
Buy me a beer if you liked this post or found it helpful














September 5th, 2007 at 4:38 pm
Great find. I wonder what they use now? I heard that they use Python for some things - anyone know if this is true?
September 6th, 2007 at 12:00 am
HAL/S is a derivative of XPL, which is a PL/I-ish language. I’ve a copy of `A Compiler Generator` which is THE XPL book. XPL is geared towards compiler construction (hence the book name), being rather small & simple. IIRC, the original HAL/S compilers were all written in XPL for various mainframe systems (for which ports of XPL had to be made first).
HAL/S has a very similar pupose as Ada, although Ada is much larger & more module. I would call attention to the fact that HAL/S has a (so far as I can tell) unique syntax using multiple lines for a single expression, hence the M:, E: & S: qualifiers. Uni. Toronto has some interesting information about HAL/S on their site, and poking around in google is always an option. http://www.cs.toronto.edu/XPL/hal.html
From what I’ve heard, HAL/S has been replaced by Ada for the most part (although I could be wrong; the Navy still uses JOVIAL for legacy weapon systems).
I think that Python use is limited to places like the JPL. Remember, these systems can have very little failure. Even stupid things (like overflows, untrapped exceptions, &c.) can lead to massive failure. The first Ariane 5 crashed because of an overflow exception that wasn’t caught (at the root of the issue). Every line of Python’s implementation would need to be checked over, and a specific version would have to be THE version used until either the next cycle or another language came up to fill the void (like Ada for HAL/S, or C++ for Ada for that matter).
September 6th, 2007 at 12:09 am
Thanks for the informative reply LiteS! I can’t imagine coding with such delicacy. We’re spoiled nowadays where a fatal error doesn’t mean death and millions of dollars.
Any idea what the modern shuttles are using?
September 6th, 2007 at 12:18 am
[…] A Clever Cookie » NASA Spaceshuttle Programming Language Exposed (tags: spaceshuttle) […]
September 6th, 2007 at 1:56 am
PHP Encoder:
“NASA is using Python to implement a CAD/CAE/PDM repository and model management, integration, and transformation system which will be the core infrastructure for its next generation collaborative engineering environment.”
- from the Python website
September 6th, 2007 at 10:37 am
HAL/S, il linguaggi per Spaceshuttle…
Avete mai pensato a scrivere un programma che poi avrebbe manovrato qualcosa all’interno di uno Shuttle?
Non sappiamo quando potrebbe arrivare la chiamata dalla NASA, però intanto possiamo cominciare a studiare un pò di HAL/S, linguaggio per la…
September 6th, 2007 at 7:44 pm
I once read an article about the quality control at NASA. Apparently the code has to be triple-checked at every point (from initial planning to final implementation) by committee. Even then they have some small mistakes which lead to billions of dollars being lost on single lines of code.
September 7th, 2007 at 12:16 am
@pat:
You’re right on the money. To continue with the Ariane 5 example, the whole crash was started by an unhandled overflow (conversion from 64-bits to 16). The exception handler had been disabled for efficiency, which could have trapped and handled such an exception. Since these are some of the ultimate realtime systems, any code that can be removed to reduce latency of calls/execution is a big plus. However, without testing each and EVERY line of code, under various conditions, you can open yourself up to catastrophic failure. This is why Ada ‘83 & ‘95 are still around and kicking: the code is well tested, known working, and kept until it can be replaced with software in the same condition (well tested & known working). As you say, even small mistakes, or even a failure to consider most conditions, can lead to wasted money, or worse death.
@thecookie:
I believe Ada is the language of choice. I’ve a friend who works for a defense contrator, and he allegeds that Ada is on the outs in favor of C++. Let’s face it, C++ is taught far more often than Ada, there are far more tools for C++ than Ada (heck, the free compilers are all from the same GNATS source), and given the right stricture, you can achive many of the goals of Ada & RavenSPARK. I’ve no idea how closely this reflects on NASA, but you can take it for what it’s worth (read: nothing =)
September 16th, 2007 at 8:41 pm
[…] 1960年代后期,NASA就已经开发出了一种可以用于实时(real time)的计算机高级语言HAL/S。下面的三张图片就是在航天飞机上使用的程序的一部分。从中我们可以领略一下美国人是如何在当时人类最为复杂的计算系统里编写指令的。有兴趣的读者可以在NASA Spaceshuttle Programming Language Exposed一文中看到更多的程序样本。 […]
October 12th, 2007 at 8:33 pm
GOAL stands for Ground Operations Aerospace Language
I worked on several Shuttle launches up until STS-13 in the early 80’s.
Each shuttle ground station computer could execute 8 programs simultaneously each using only 64Kb of memory. GOAL was only capable of 8bit math functions. When I left they were contemplating upgrading to 128Kb of memory:->
The main purpose of the language was to abstract all of the data streaming from the orbiter. This allowed common names to be used instead of bit 7 of word 12801.
February 10th, 2008 at 3:34 am
The first one reminds me of C. anyways lol qbasic ftw
ps. C > C + +