Syntax (programming languages)

syntaxsyntacticallysyntacticsyntaxeslanguage syntaxsyntax of the languageconstructslanguage grammarsyntax of programming languagethe language's essential syntax
In computer science, the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.wikipedia
192 Related Articles

Programming language

programming languageslanguagedialect
This applies both to programming languages, where the document represents source code, and to markup languages, where the document represents data.
The description of a programming language is usually split into the two components of syntax (form) and semantics (meaning).

Syntax error

syntax errorscompile timeS
Documents that are syntactically invalid are said to have a syntax error.
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 compile-time.

Lexical analysis

tokenslexical analyzertoken
First, a lexer turns the linear sequence of characters into a linear sequence of tokens; this is known as "lexical analysis" or "lexing".
A lexer is generally combined with a parser, which together analyze the syntax of programming languages, web pages, and so forth.

Regular expression

regular expressionsregexregexp
Words are in a regular language, specified in the lexical grammar, which is a Type-3 grammar, generally given as regular expressions.
Different syntaxes for writing regular expressions have existed since the 1980s, one being the POSIX standard and another, widely used, being the Perl syntax.

Backus–Naur form

BNFBackus-Naur formBNF grammar
Phrases are in a context-free language (CFL), generally a deterministic context-free language (DCFL), specified in a phrase structure grammar, which is a Type-2 grammar, generally given as production rules in Backus–Naur form (BNF).
In computer science, Backus–Naur form or Backus normal form (BNF) is a notation technique for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document formats, instruction sets and communication protocols.

Lexical grammar

lexical specificationlexical syntax
Words are in a regular language, specified in the lexical grammar, which is a Type-3 grammar, generally given as regular expressions.
In computer science, a lexical grammar is a formal grammar defining the syntax of tokens.

Haskell (programming language)

HaskellHaskell programming languageHackage
Parsers are often written in functional languages, such as Haskell, or in scripting languages, such as Python or Perl, or in C or C++.

Reserved word

keywordkeywordsreserved keyword
Terminal symbols are the concrete characters or strings of characters (for example keywords such as define, if, let, or void) from which syntactically valid programs are constructed.
This is a syntactic definition, and a reserved word may have no meaning.

Semantics (computer science)

semanticsformal semantics of programming languagesformal semantics
Syntax therefore refers to the form, and it is contrasted with semantics – the meaning.
It does so by evaluating the meaning of syntactically valid strings defined by a specific programming language, showing the computation involved.

C (programming language)

CC programming languageC language
Parsers are often written in functional languages, such as Haskell, or in scripting languages, such as Python or Perl, or in C or C++.
These languages have drawn many of their control structures and other basic features from C. Most of them (Python being a dramatic exception) also express highly similar syntax to C, and they tend to combine the recognizable expression and statement syntax of C with underlying type systems, data models, and semantics that can be radically different.

Perl

Perl 5Perl programming languagePerl Script
Parsers are often written in functional languages, such as Haskell, or in scripting languages, such as Python or Perl, or in C or C++.
Perl's syntax reflects the idea that "things that are different should look different."

JavaScript syntax

Variable hoistingAutomatic Semicolon Insertiondefensive semicolon
The syntax of JavaScript is the set of rules that define a correctly structured JavaScript program.

Python syntax and semantics

PythondecoratorsPython Decorators
The syntax of the Python programming language is the set of rules that defines how a Python program will be written and interpreted (by both the runtime system and by human readers).

Computer science

computer scientistcomputer sciencescomputer scientists
In computer science, the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.

Computer language

computer languageslanguagelanguages
In computer science, the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.

Source code

codesourcesource file
This applies both to programming languages, where the document represents source code, and to markup languages, where the document represents data.

Markup language

markupmarkup languagestext encoding
This applies both to programming languages, where the document represents source code, and to markup languages, where the document represents data.

Visual programming language

visual programmingvisualvisual programming languages
Text-based computer languages are based on sequences of characters, while visual programming languages are based on the spatial layout and connections between symbols (which may be textual or graphical).

Concurrency (computer science)

concurrencyconcurrentconcurrently
In processing computer languages, semantic processing generally comes after syntactic processing; however, in some cases, semantic processing is necessary for complete syntactic analysis, and these are done together or concurrently.

Compiler

compiledcompilerscompile
In a compiler, the syntactic analysis comprises the frontend, while the semantic analysis comprises the backend (and middle end, if this phase is distinguished).

Parsing

parserparseparsed
Second, the parser turns the linear sequence of tokens into a hierarchical syntax tree; this is known as "parsing" narrowly speaking.

The lexer hack

This modularity is sometimes possible, but in many real-world languages an earlier step depends on a later step – for example, the lexer hack in C is because tokenization depends on context.

Parse tree

concrete syntax treesyntax treeconcrete syntax
The parsing stage itself can be divided into two parts: the parse tree, or "concrete syntax tree", which is determined by the grammar, but is generally far too detailed for practical use, and the abstract syntax tree (AST), which simplifies this into a usable form.

Abstract syntax tree

ASTabstract syntax treessyntax tree
The parsing stage itself can be divided into two parts: the parse tree, or "concrete syntax tree", which is determined by the grammar, but is generally far too detailed for practical use, and the abstract syntax tree (AST), which simplifies this into a usable form.

Chomsky hierarchy

Chomsky–Schützenberger hierarchyChomsky-Schützenberger hierarchyChomsky (1956) hierarchy
The levels generally correspond to levels in the Chomsky hierarchy.