In relation to spoken and written language, syntax refers to the structure of sentences and how words, phrases, and clauses are formed and relate to each other. Within the realm of computers, the meaning of the term syntax is the set of rules that govern a programming language’s structure and how instructions, statements, and expressions are properly formed. A syntax highlighting editor is a tool to help programmers find syntax errors and/or clearly display to others how a section of code was constructed.
In programming languages, an instruction or statement is a phrase that results in at least one machine language instruction for the computer. An expression, on the other hand, returns a value. Programming is composed of a combination of instructions or statements and expressions. Each program has specific syntax requirements that must be followed in order for the computer to understand the instruction. Failure to follow proper syntax results in a syntax error, and it is said that the statement or expression cannot be parsed.
The syntax highlighting editor is created specifically for one or more programming languages. For each language it is meant to be used with, it uses color to make the code more easily readable by humans, while making no changes to the code itself. For example, it may make all the values one color, while making all the comments a different color. One syntax highlighting editor may use different colors than another, or color more or fewer items. Other features may also be included in a syntax highlighting editor, for example, some provide line numbers to assist in finding syntax errors, while others do not, and only some have the ability to copy to clipboard or download.
A syntax highlighting editor may be a stand alone program. Alternatively, it may be a facet of a full-featured web design or other program. In such programs, it is typical to find a set of frequently used programming languages included as a default. However, even if a programming language is not included as a default, it may be possible to add syntax highlighting for other languages being employed.