Abstract Syntax
Every programming language has a concrete syntax.
Furthermore, every implementation of a programming language uses an abstract syntax.
The programming language Wren is a small imperative language whose only control structures are the if command for selection and the while command for iteration.
An example program of Wren is given as follows:
The following list explains the two kinds of syntax of Wren:
- Concrete syntax of a programming language, which tells how to recognize the physical text of a program.
One of the examples is the BNF definition of a programming language such as the concrete syntax of Wren.
- Abstract syntax of an implementation, which is the set of trees used to represent programs in the implementation.
This is, the abstract syntax defines the way the programs look like to the evaluator/compiler.
The link gives the abstract syntax of Wren.
The abstract syntax is part of the definition of a particular implementation (evaluator or compiler) of a language.
If the language allows us to access the implementation structures from within itself (such as Scheme, which allows us to treat programs as Scheme data structures; i.e. Scheme lists), then of course, the abstract syntax becomes part of the definition of that language.