Question: What's a good program to help you program...?

Keywords:

  1. We use programs called “compilers” to translate something easy for us to write into the millions of instructions needed by the computer.
    To print out the number 1 to 10 and their squares in a computer language you might write:
    for i = 1 to 10
    print i, i * i
    next i
    (This is in a very simple language called BASIC). In a simple computer language (it is really all numbers but we can give the instructions names) this might look like
    cla ;; clear the accumulator (a)
    clb ;; and the second accumulator (b)
    start: ;; a label
    tba ;; copy the contents of b into a
    ina 1 ;; add 1 to a
    call print ;; We overlook the thousands of instructions to see if we CAN print and turn the value in the accumulator into printable characters
    tab ;; make a copy of a in the a second “register” (b)
    mula ;; multiply a by b
    call print
    call newline ;; to move to the next line
    tba ;; copy b back into a
    deca 10 ;; subtract 10 from a
    bnz ;; start
    stop
    Now if I got that all right, it would be the same as the original.
    Which do you think is easier?
    There are hundreds of computer languages. The one I am mostly using at the moment is called “C” (it followed on from an earlier language called “B”) and looks a little like BASIC. Some of them are really simple, some very complex. C is somewhere in the middle. We choose a particular language because it is available on the computer we are using and because it suits the problems we are doing.

    0

Comments

  1. So, BASIC isn’t that basic after all.

    0