What are errors and compiler

Compiler and errors

What are errors and compiler

Compiler used for checking code is correct or not. if the code not correct than
after compiling, its shows an errors (syntax error, semantic error, type error,
run time error) and detail about on which line and what type of an errors come.

compiler is used for compile a program code.so machine can detect it and understand in its own
language. when program code is not correct than it helps to show us, where mistake is done.

1-Compiler is used for analyze the program code for “correctness”.

when a program code is correct. it will not show any error.
otherwise it will show an error.

2- Errors are of different types 

3- Syntax Errors
syntax errors occur when code of a program is not correct.
when a grammatical rule of a program is violated.
void main()
               int no1,no2.
               cout<<“enter the value of a program”‘
            }           getch();
syntax error in this programs are
-After no2.   it use this(.), instead of this(;)
-In first cout at the end use (‘) but we have to use this(;)
-In second cout. it is use (,), in the place of(;)

right code of a program is
void main()
    int no1,no2;
cout<<“enter the value of a program”;
}  getch();

4- Semantics Error 
when a meaning of a program is not understandable and there is problem with statement.
example— paper write on you.(this statement is correct properly by syntax but semantics of
a statement is not correct.
in a program we can write wrong semantics as
these all are semantically incorrect.
write example of these are
you write on paper
and for second one

5- Type Errors 
we know that we have data type in C++
when we change the value like we put int a and
give a value of a is b that time type error occurred.
Ex- char a;
and give value to a is 5 than this will not work because we put number in the place of character.

6- Run-time Errors
it occure when we trying to open a file and file is not found or the space for required to save a file is not present.
Example- when we divide a no by 0 that time it show us an run-time error

7- Logical Errors 
errors come when program give undesired output.
ctr=1 ;
loop will not be executed even condition (ctrl>11) is not fulfilled.than no output will produced.
such an error is called logical error.

8- How to compile a program 

when a compiler run a program that time, it compile a program line by line.
if program is not executed properly than error is occurred in a program and it shows an
error message contains a line number and brief description of an error.
a compiler , translate a corrected program text into object or  assembly instruction text(AIT) which is
only understand by the computer.
that process of a program is called a code generation. from here execution of a program take place.
program only check logical error by line by line. or check syntax error, semantic error , run time 
error, type error in a run time. 

1-Use of compiler
2-Types of an an errors
3-Syntax error
4-Semantic error
5-Type error
6-Run time error
7-Logical error
8-Compiling of a program

Memory boost tips

Leave a Reply

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