Generations of code

In order of generation, types of code:

  1. Machine code (Object code)
  2. Assembly code
  3. High Level Language (Source code)
  4. Declaration Language (SQL)

Translators

The role of the translator is to take program code/source code and to translate it into machine code.

  • Assembler (Assembly code to machine code)
  • Compiler (Source code to machine code)
    • A compiler takes whole source code and translates it into object code
    • Compiled code executes quicker
    • Produces an executable file
  • Interpreter (Source code to machine code)
    • An interpreter translates a programs source code line-by-line
    • Interpreters are slower than running compiled code
    • Source code is required for the program to be interpreted

Situations translators are used

Compiler

  • So that source code cannot be accessed by user
  • When the program is to be distributed as an executible
  • Where speed of execution is important

Interpreter

  • To allow execution on a wide range of processors
  • When prototyping and testing code
  • When no compiler yet exists for the processor

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s