A syntax error occurs when the programmer has not followed the proper rules of the programming language being used. Furthermore, a syntax error is under the category of compile-time error.
EXPLANATION:
An error is also called 'a bug' in the programming language. Error in the programming language is whatever in the code that blocks a program from running and compiling correctly. Generally, there are three kinds of errors in a programming language:
•Compile-Time Errors
An error that occurs in compile time is a compile-time error. When a program is compiled, the source code is checked whether it follows the rules of the programming language or not. Furthermore, there are two types of errors that are included in the compile-time error category:
•Syntax errors: errors because of the syntax of the language is not respected.
•Semantic errors: errors because of the improper use of program statements.
•Run-Time Errors
Errors that occur in program execution are run-time errors. Some errors are more difficult to detect errors. Some run-time errors block the program execution which is then named "terminated abnormally" or "Program crashed.” Most run-time errors are easily identified because programs stop when they meet with them. For example, infinite loops or incorrect values (of different data types other than those needed) are input.
•Logical Errors
Sometimes, even whether you don't find any errors in compile-time and run-time, the program is not giving correct results. It is due to the programmer's fault analysis of the problem which he or she is trying to solve. Such mistakes are logical mistakes.
LEARN MORE
If you’re interested in learning more about this topic, we recommend you to also take a look at the following questions:
•Programming languages were developed in order to?
•A error occurs when an instruction does not follow the grammar of the programming language
Keywords: Syntax errors, programming language
Subject : Computers & Technology
Class : College
Sub-Chapter: Programming Language