Syntax

Each 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 languages, syntax serves the same purpose, defining how declarations, functions, commands, and other statements should be arranged.

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

Regardless of the rules, a program's source code must have the correct syntax in order to compile correctly and be made into a program. In fact, it must have the exact right 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 software development programs include a debugger, which helps find the exact location of syntax errors within the source code. Imagine a program that has over ten thousand lines of code and a syntax error is caused by one missing semicolon. Finding a needle in a haystack would be preferred over manually locating the error. Needless to say, the debugger makes the debugging process much easier for the programmer.

Updated: October 11, 2007

space