Home / Definitions / Syntax

Syntax

Vangie Beal
Last Updated May 24, 2021 7:56 am

Syntax refers to the spelling and grammar of a programming language. Computers are inflexible machines that understand what you type only if you type it in the exact form that the computer expects. The expected form is called the syntax.

Each program defines its own syntactical rules that control which words the computer understands, which combinations of words are meaningful, and what punctuation is necessary to be a correctly structured document.

Levels of Syntax

The three levels of syntax include the following:

  • Lexical syntax: All the basic symbols of the language (i.e. names, values, operators).
  • Concrete syntax: The rules for writing expressions, statements and programs.
  • Abstract syntax: The internal representation of the program specified by a simpler grammar than the concrete syntax.