This section contains 334 words (approx. 2 pages at 300 words per page) |
Syntax is simply the rules that define the structure of a programming language. These rules specify how the words, symbols, and punctuations are used to form a statement. Each program, thus, has its own set of syntactical rules. The format used by a program governs which words are meaningful to the computer, how they are spelled, in what combination they are to be written, and what punctuation is necessary. In human languages these rules are rather relaxed, but in computer programming languages these rules are inflexible. If the rules of syntax are not followed exactly, the computer will not understand it, and the user will get a syntax error message.
A syntax error is basically any error that breaks one of the strict rules of grammar imposed by any language. All errors must be "caught" and corrected before the program will run. An example of a syntax error would an error in logic. This would be something like defining a set of operations that are not permitted. To illustrate, adding together the two Boolean types. In Boolean logic, all operations produce one of two possible alternative values--either something is true or it is false. Obviously, something cannot be true and false at the same time.
Finding every syntax error in a document can be a tedious process. There are programs available, however, that are able to check for syntax problems during compilation. The compiler is that portion of the program that reorganizes the source code and turns it into the object code, which is what the computer understands. This would be the equivalent of translating the human language into the machine language. The process for tracking down syntax errors is called parsing, or syntax analysis. Once an error is found these programs are able to locate where the error is within the code and also indicates what rule has been broken--punctuation, incomplete statement, etc. Logic errors, however, are more difficult to discover and often require a skilled human programmer to detect them.
This section contains 334 words (approx. 2 pages at 300 words per page) |