Sunday, 1 November 2015

Compilers vs. Interpreters

Compiler:

  •  Compiler reads the entire program and converts it into object code, which is a translation of the program's source code into a form that the computer can execute directly. 
  • Object code is also referred to as binary code or machine code.
  • Once the program is compiled, a line of source code is no longer meaningful in the execution of your program.     

Interpreter:
               An interpreter reads the source code of your program one line at a time, executing the specific instructions contained in that line.

In general, an interpreted program runs slower than a compiled program. Remember, a compiler converts a program's source code into object code that a computer can execute directly. Therefore,

compilation is a one-time cost, while interpretation incurs an overhead each time a program is run.

C is a Middle-Level Language

What are Low Level,Middle Level and High Level languages?

Low Level Language: 
                             A low-level language is a programming language that provides little or no abstraction of programming concepts, and is very close to writing actual machine instructions. 
Eg: Machine Code, Assembly,etc.

High Level Language:
                                        It is more like human language and less like machine language. However, for a computer to understand and run a program created with a high-level language, it must be compiled into machine language.

Middle Level Language:
                           It is between Low level and High level languages.Middle Level languages are used to do System Programming as well as Application Programming.

C is Middle Language Why?
                             C is called middle-level language because it is actually bind the gap between a machine level language and high-level languages. User can use c language to do System Programming (for writing operating system) as well asApplication Programming (for generate menu driven customer billing system ). That's why it is called middle level language.


C Language History

For making these posts i follow "C The Complete Reference"(Fourth Edition) By Herbert Schildt

  1.  BCPL is invented by Martin Richards for writing compilers in 1966, which led to the development of B language.
  2.  B language is invented by Ken Thompson(along with Dennis Ritchie) at Bell labs Circa in 1969, which led to the development of C language.
  3.  C language was invented and first implemented by Dennis Ritchie at AT&T Bell Labs in 1973, which led to the development of C++ ,Java and many other Programming Languages.


BCPL:
         BCPL (Basic Combined Programming Language) is a procedural, imperative, and structured computer programming language designed by Martin Richards of the University of Cambridge in 1966.

B:
     B was designed for recursive, non-numeric, machine independent applications, such as system and language software.

C:
     C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations.