Jump to content

Syntax error

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Dolving (talk | contribs) at 20:26, 7 January 2016 (See also: the name of a musical production by Swedish artist Peter Dolving). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Syntax error in a scientific calculator

In computer science, a syntax error is an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language.

For compiled languages syntax errors occur strictly at compile-time. A program will not compile until all syntax errors are corrected. For interpreted languages, however, not all syntax errors can be reliably detected until run-time, and it is not necessarily simple to differentiate a syntax error from a semantic error; many don't try at all.

In 8-bit home computers that used BASIC interpreter as their primary user interface, the SYNTAX ERROR error message became somewhat notorious, as this was the response to any command or user input the interpreter couldn't parse.

A syntax error may also occur when an invalid equation is entered into a calculator. This can be caused, for instance, by opening brackets without closing them, or less commonly, entering several decimal points in one number.

In Java the following is a syntactically correct statement:

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

while the following is not:

System.out.println(Hello World);

The second example would theoretically print the variable Hello World instead of the words Hello World. However, a variable in Java cannot have a space in between, so the syntactically correct line would be System.out.println(Hello_World).

A compiler will flag a syntax error when given source code that does not meet the requirements of the language grammar.

See also

Hip hop Album in Swedish by Swedish musician Peter Dolving´s(The Haunted, MaryBeatsJane, etc.) hiphop aka. Syntacks https://peterdolving.bandcamp.com/track/tomas-ledin