Thursday, 24 March 2016

Transaltors

















Translators https://www.youtube.com/watch?v=UutE0IAWzBA

A translator takes source code and turns it into machine code there are 3 types:

Assemblers
  • Assemblers will convert low level assembly code into machine code , usually in a 1 to 1 conversion , one line corresponds to a machine code instruction.
  •  Both compliers and interpreters will compile source code into machine code,
  • They both have a 1 to a many relationship , a single line of source code may become many lines of binary equivalent machine code.
  •  responsible for converting low level assembly language into machine code.(short code is mnemonics)
  • process specific , not generalizable with other processors
  • one line of assembly language turns into one line of binary language
Interpreters
  • interpreters take one line of high level source code and convert it directly into machine code and run it tis allows a program to run immediately but will stop when it reaches a line with the first error,
  • but this requires to access to the whole source code every time it is ran. This is a security issue as anyone can see the source code and it means its slow.
  • could create security issues (source code has to be public)
Compliers
  • However a complier will take the whole source code and convert it all into machine code , this can take a long time. Errors will need to be fixed before running.
  • Compliers will convert source into object code (close to machine code) this means the source code is not required once complied.
  • The compiled code will run faster , if there are any changes, responsible for converting high level language
intermediate code (object code) the in-between part between complier and machine code (bit of both)

each line of compliers or interpreters (high level language) can turn into dozens of lines in machine code(one to many relation ship)
  1. .complier generates some code 
  2.  this code will be save as an executable file
  3. Another name for this exe file is "object" file
  4. When the exe file (or object file) is run then the machine code commands that it contains start to processed by the CPU
  5.  example of an executable file is Notepad.exe (in Windows executable files have this extension)
  6. Because different CPUs have a different set of machine codes, the compiler will necessarily need o have the target CPU defined before it carry out the translation
  7.  You could, for instance, purchase C++ commercial compilers and these would target the Intel x 86 family of processors specifically







No comments:

Post a Comment