Home  >  Article  >  What does syntax error mean?

What does syntax error mean?

青灯夜游
青灯夜游Original
2020-04-24 14:52:00189915browse

Syntax error means "syntax error", which means that the syntax of the program is incorrect and the compiler or interpreter cannot convert it into an appropriate programming language during lexical analysis. In compiled languages, syntax errors only occur during compilation, because the compiler requires all syntax to be correct in order to compile correctly; in interpreted languages, syntax errors may not appear until runtime.

What does syntax error mean?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

Programming is the process of developing software through code. Some beginners encounter many errors during the learning process. Among them, syntax error is the most common. So what does syntax error mean? The following article will introduce it to you.

What does syntax error mean?

syntax error means "grammatical error".

In computer science, a syntax error refers to a program with incorrect syntax that the compiler or interpreter cannot convert into an appropriate programming language during lexical analysis.

Expansion

In compiled languages, syntax errors must only appear during compilation. The compiler must have all syntax correct to compile correctly. However, grammatical errors in interpreted languages ​​may not appear until runtime, and it is not necessarily easy to distinguish grammatical errors from semantic errors.

The user interface of early 8-bit home computers was a BASIC interpreter. The SYNTAX ERROR error message often caused trouble to users. This message would appear as long as the interpreter could not recognize the user's input.

If the calculator outputs incorrect calculations, syntax errors will also occur. For example, there are left brackets but no right brackets in the calculation, or there are multiple decimal points in a number.

In Java language, the following program is correct:

System.out.println("Hello World");

The following program is incorrect:

System.out.println(Hello World);

The second program theoretically displays something called Hello World variable instead of the word Hello World, and there cannot be spaces in variable names in Java language, so a syntax error will occur.

The compiler will mark lines with syntax errors in the program, and may also provide a simple explanation.

For more related knowledge, please pay attention to PHP Chinese website! !

The above is the detailed content of What does syntax error mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn