Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Question about inventing a language program

  1. Sep 27, 2008 #1

    fluidistic

    User Avatar
    Gold Member

    I am wondering how the man that invented FORTRAN did so.
    More precisely :
    It is not really the language that he invented but more likely a compiler that would understand some syntax that we call "language". So how did he write its compiler? In order to make it work it necessitate a compiler itself, or in other words, the compiler is a program itself. Am I right?
    So if I continue... how was invented the first program? How was it writed I mean, and compiled or executed...
     
  2. jcsd
  3. Sep 27, 2008 #2

    harborsparrow

    User Avatar
    Gold Member

    the first compiler (or similar "language" tool) for any computer has to be written in that computer's native machine instruction set. once you have implemented any 'general purpose' programming instruction set (and yes, the compiler is itself just a program that translates one kind of command into raw machine instructions)...once you have the first compiler, other languages can be implemented for the same computer with less effort by using the first language to program the second language's compiler.
     
  4. Sep 27, 2008 #3

    harborsparrow

    User Avatar
    Gold Member

    and incidentally, FORTRAN was not the "first" high-level, general purpose programming language. COBOL was. and, the concept of creating languages like FORTRAN was dreamed up by a woman (Grace Murray Hopper).
     
  5. Sep 27, 2008 #4

    fluidistic

    User Avatar
    Gold Member

    Thank you very much for the information.
    But still I wonder about
    what is exactly the native machine instruction set? Does that mean that we have to build a computer in such a way that it would recognize a specific syntax? If yes, how can we build that? If no, does that mean that we have to "change" what does the computer in order to make it work as a compiler? If yes, how can it be done?
    And yes, I understand that when we already have a compiler and a language, it's easier to "invent" another compiler and language.
     
  6. Sep 27, 2008 #5

    jtbell

    User Avatar

    Staff: Mentor

    All computers have a native instruction set that their CPUs are "hard-wired" to recognize. In its most fundamental form, an instruction is a string of 0's and 1's (binary bits).

    For example (just to make up a hypothetical instruction format on the spot), an instruction might consist of 32 bits, of which the first eight specify the particular operation (add, multiply, jump, etc.), the next four are "modifiers" that specify variations on the basic operation, and the remaining twenty bits are the address (in RAM) of the data that the operation is to act on. Different models of CPU chips have different instruction sets.

    When I was an undergraduate in the early 1970s, I played with a computer that could be programmed by setting a row of switches (on the front panel), which represented either a machine instruction or a RAM address, in binary notation. To program it, I first set the switches to represent the RAM address where I wanted to put the first instruction, then pressed a button to tell the machine to use that address. Then I set the switches to represent the actual instruction, and pressed another button to load the instruction at that address. I think it automatically incremented the address by one, so I could enter the instructions one after the other without having to set the address explicitly each time. When I was done, I set the address switches to the address of the first instruction and pressed the "run" button.

    Normally, I ran programs that had already been punched onto paper tape in a binary code, by reading them in with a paper tape reader. But before I could do that, I had to load a short program to drive the paper tape reader, by using the switches.

    (For any fellow grey-beards who happen to read this, the computer was a Digital Equipment PDP-5, if I remember correctly.)
     
    Last edited: Sep 29, 2008
  7. Sep 28, 2008 #6

    fluidistic

    User Avatar
    Gold Member

    Thanks jtbell, I found what you wrote very interesting.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?