The world's first compiler was written in its own language

in #programming6 years ago (edited)

While answering a question on Quora (Didn't the person who wrote world's first compiler have to compile it somehow? Did he compile it at all, and if he did, how did he do that?) I found an English translation of the dissertation that introduced the notion of a compiler, by Corrado Böhm, in 1951. The translation can be read here: http://www.itu.dk/people/sestoft/boehmthesis/boehm.pdf

The language Böhm invented was not given a name (it certainly wasn't obvious that it needed one!) and consisted entirely of assignment statements. Böhm wrote the compiler for this language in its own language. The target machine was an abstract machine that resembled the stored-program computers of the day. It's sort of amazing that the very first compiler was not only self-hosted, but targeted a virtual machine rather than actual hardware!

Böhm illustrated the behavior of his programs with graphs; here's the graph of the compiler's control flow:

Here's the first few blocks of his compiler, laid out in tabular form with comments on the left and the code on the right. Böhm's language conventions:

  • π is the program counter, so jumps are just assignments.
  • The ↓ symbol is used for indirection (reads and writes from a location specified in a variable, like * in C.)
  • A + for addition and a dot for multiplication
  • A - with a dot over it for subtraction (which was a common convention) and : for integer division
  • The obelus ÷ is used for "absolute difference"
  • ∪ and ∩ for minimum and maximum
  • mod is the modulus (remainder) operator

Sort:  

Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!

Reply !stop to disable the comment. Thanks!

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63792.82
ETH 2563.50
USDT 1.00
SBD 2.66