programming languages

Cards (12)

  • there are two main types of programming language:
    • high-Level (e.g. Python)
    • low-Level (e.g. Machine Code)
    • machine code is instructions written in binary, where one instruction relates to one thing that the computer needs to do e.g. fetch a piece of data from memory
    • low level languages are those that are extremely close to machine language
    • high level languages are those that are relatively easy for programmers to use, as they involve a large amount of English language
    • computers can only understand machine code, so all higher-level programming languages must be translated before the computer can understand them
  • low level vs high level languages
    A) operating
    B) firmware
    C) micro
    D) creative
    E) multiple
    F) most
    G) machine
    H) fast
    I) slower
    J) translated
    K) specific
    L) cannot
    M) easily
    N) challenging
    O) debugged
  • there are three common types of program translator:
    • assembler
    • compiler
    • interpreter
  • an assembler converts assembly source code into machine code
    • a compiler translates the whole program into machine code before the program is run
    • the machine code is saved and stored separately to the high-level code
    • an interpreter translates code into machine code, instruction by instruction - the CPU executes each instruction before the interpreter moves on to translate the next instruction
    • if it comes across an error in the code, the program will stop running
    • an interpreter does not create an independent final set of object code - object code is created each time it runs
    • machine code is expressed in binary
    • machine code is the only language directly executable by processors
    • every processor has its own specific machine code instruction set
    • assembly language must be translated by an assembler for the computer to understand it
    • it has a 1:1 correspondence with machine code - one instruction in assembly language corresponds to one instruction in machine code
    • this means that assembly language is also specific to a processor or family of processors, and can’t be used across different pieces of hardware
    • assembly language is often used to develop software for embedded systems and for controlling specific hardware components
  • advantages of interpreters
    • the file that needs to be run can be transferred between machines. for example, some elements of interactive webpages use an interpreted language, because they can be sent and translated to any machine, regardless of the hardware being used on them
    • they are easy to test and debug, as an interpreted program will stop when it finds an error, and report where that error was
    • doesn’t require compiling each time, which makes it quicker to run the file when testing.
  • advantages of compilers
    • from the compiled machine code file that the compiler creates, the program is much quicker to run
    • there is no need for a translator for the program to run each time
    • the final program can’t be changed from the source code file, as the person running the program is only provided with the compiled machine code
    • most importantly, this means that the original source code file is private, which is very useful when creating commercial programs