r/programminghelp • u/[deleted] • Nov 23 '22
R Eli5 how can people code a coding software? When the first coding “language” was created. How did they code that if there was no other language to code the new language
I didnt know where to post this, in r/explainlikeimfive it got removed and in r/programming it wasnt possible. Idk where else to post this
2
u/CorporalRustyPenis Nov 23 '22
All code gets converted to binary instructions the machine can understand. The machine cannot understand any programming language any more than it can understand English, it can only understand binary instructions in the CPU instruction set. Through a process called compilation, the code you write gets converted to binary instructions that the machine can understand. Compilers are essentially translators that can translate whatever language it compiles into native machine instructions. The first compiler was written by hand with machine instructions.
2
u/qlkzy Nov 23 '22
This is a problem called bootstrapping. You can do it by hand, from scratch, provided your programming language is simple enough, by working through each step of compilation on pencil and paper.
Once you had the necessary machine code written out by hand, you could then get it into the memory of your computer using punched cards or paper tape.
Obviously this process is very laborious, so if you did have to start from scratch, the general procedure would be to build up gradually: hand-compile a very small and simple programming language, then use that to implement a larger and more useful language, and so on.
This approach was still occasionally used into the 1980s, but it's mainly a hobby curiosity these days. The advantage is that you can start immediately writing a self-hosting compiler (which is often the end goal for systems languages), rather than having to write an initial compiler in another language then throw it away.
6
u/Ok-Wait-5234 Nov 23 '22 edited Nov 23 '22
Originally, computers were programmed by physically entering instructions into their instruction memory. Programming was a case of writing the program by hand on paper as assembly language instructions, converting those by hand into machine code instructions and writing those down, and then using a machine to punch holes representing those instructions into special cards. The cards would be loaded into a reader which would read them into the computer's memory.
Eventually, computers became good enough and cheap enough that it was worthwhile using them to run a program that would let you enter assembly language onto the computer, and have it do all the conversion into machine code (and maybe even output the punch cards to be taken elsewhere). From there, people wrote compilers for primitive higher-level languages, building on the work that was previously done.