Syntax

Every spoken language has a general set of rules for how words and sentences should be structured. These rules are collectively known as the language syntax. In computer programming, syntax serves the same purpose, defining how declarations, functions, commands, and other statements should be arranged.

Many computer programming languages share similar syntax rules, while others have a unique syntax design. For example, C and Java use a similar syntax, while Perl has many characteristics that are not seen in either the C or Java languages.

A program's source code must have correct syntax in order to compile correctly and be made into a program. In fact, it must have perfect syntax, or the program will fail to compile and produce a "syntax error." A syntax error can be as simple as a missing parenthesis or a forgotten semicolon at the end of a statement. Even these small errors will keep the source code from compiling.

Fortunately, most integrated development environments (IDEs) include a parser, which detects syntax errors within the source code. Modern parsers can even highlight syntax errors before a program is compiled, making it easy for the programmer to locate and fix them.

NOTE: Syntax errors are also called compile-time errors, since they can prevent a program from compiliing. Errors that occur in a program after it has been compiled are called runtime errors, since they occur when the program is running.

Updated August 12, 2011 by Per C.

quizTest Your Knowledge

Which of these is an example of an ad hoc network?

A
A password-protected public coffee shop Wi-Fi network
0%
B
An office ethernet network with multiple switches and routers
0%
C
A home network using both Wi-Fi and ethernet
0%
D
A temporary peer-to-peer Wi-Fi connection between two laptops
0%
Correct! Incorrect!     View the Ad Hoc Network definition.
More Quizzes →

The Tech Terms Computer Dictionary

The definition of Syntax on this page is an original definition written by the TechTerms.com team. If you would like to reference this page or cite this definition, please use the green citation bar directly below the definition.

Our goal to explain computer terminology in a way that is easy to understand. We strive for accuracy and simplicity with every definition we publish. If you have feedback about this definition or would like to suggest a new technical term, please contact us.

TechTerms Newsletter

Improve your technical knowledge with our daily or weekly newsletter! Subscribe today and get new terms and quizzes delivered to your inbox.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe or change your frequency setting at any time using the links available in each email.

Questions? Please contact us.