Programming Language-Complier and Interpreter

 

Welcome to class!

In today’s class, we will be talking about programming language- compiler and interpreter. Enjoy the class!

Programming Language- Compiler and Interpreter

Complier and Interpreter classnotes.ng

Advantages of using a compiler

  1. Source code is not included, therefore compiled code is more secure than interpreted code
  2. Tends to produce faster code than interpreting source code
  3. Produces an executable file, and therefore the program can be run without the need of the source code

Disadvantages of using a compiler

  1. Object code needs to be produced before a final executable file, this can be a slow process
  2. The source code must be 100% correct for the executable file to be produced

Interpreter: 

An interpreter program executes other programs directly, running through program code and executing it line-by-line. As it analyses every line, an interpreter is slower than running compiled code but it can take less time to interpret program code than to compile and then run it — this is very useful when prototyping and testing code.

Interpreters are written for multiple platforms, this means code written once can be run immediately on different systems without having to recompile for each. Examples of this include flash-based web programs that will run on your PC, MAC, games console and Mobile phone.

Advantages of using an interpreter
  1. Easier to debug(check errors) than a compiler
  2. Easier to create multi-platform code, as each different platform would have an interpreter to run the same code
  3. Useful for prototyping software and testing basic program logic
Disadvantages of using an interpreter
  1. Source code is required for the program to be executed, and this source code can be read making it insecure
  2. Interpreters are generally slower than compiled programs due to the per-line translation method
Stages of programming

There are six stages in developing a good program.

  1. Program analysis
  2. Program design
  3. Program coding
  4. Program verification
  5. Program documentation
  6. Program maintenance
Flow chart:

This is the pictorial or graphical representation of steps in writing a program.

com

Flow Chart

An algorithm is a step by step procedure in solving a problem or task

Basic programming language

The programming language must have the following basics

  • Language syntax:

This involves codes which are understood by computer compiler of the computer language. Example “20” is a Hausa syntax. The compiler has its own syntax and it includes

  1. Print
  2. REM
  3. Input
  4. Output
  5. Tab
  • Variable:

Also known as an identifier, which contains some known or unknown quantity of information referred to as a value.

  • Constant:

These are data items which do not change during program execution.

Examples include:

1, 2, 3 ……..

A, B, C, .…..

  • Operator:

This can be arithmetic, relational or logic.

Examples:

  • Arithmetic operators include (arithmetic language):

+ = addition

– = subtraction

x = multiplication

/ = division

؈ or ** = Exponent

  • Relational operators include:

= for equality

> = greater than

< = less than

≤ = less than or equal to

≥ = greater than or equal to

  • Logical operations:

True or false

Yes or no

OR or AND

Every program must have

  1. Beginning
  2. End
  3. Body
Evaluation
  1.  ____ converts high level or low-level language to machine language
    (a) transmitter (b) translator (c) transferrer (d) transducer
  2. One of these is not a type of translator
    (a) assembler  (b) compiler (c) interpreter  (d) silicon
  3. If the translator translates target/machine code to source language it is called a
    (a) machiner  (b) language (c) decompiler  (d) congester
  4. ______ is capable of converting high-level language to machine language directly. (a) assembler (b) compiler (c) interpreter (d) silicon
  5. How many stages are involved in developing a good program?
    (a) 4  (b) 5 (c) 6  (d) 7

 

In our next class, we will be talking about the Computer System and the Internet. We hope you enjoyed the class.

Should you have any further question, feel free to ask in the comment section below and trust us to respond as soon as possible.

For more class notes, homework help, exam practice, download our App HERE

Join ClassNotes.ng Telegram Community for exclusive content and support HERE

Leave a Reply

Your email address will not be published. Required fields are marked *

Don`t copy text!