COPL 3 - Describing Syntax and Semantics#
3.1 - Introduction#
A major problem in describing a language is the diversity of people who must understand the description, including initial evaluators, implementors, and users.
The syntax of a programming language is the form of its expressions, statements, and program units.
The semantics of a programming language is the meaning of the expressions, statements, and program units.
3.2 - The General Problem of Describing Syntax#
A sentence or a statement is a string of a language. The smallest syntactic unit of a language is called a lexeme. Lexemes are partitioned into groups (variables, methods, classes, etc.). These categories of lexemes are called tokens.
3.2.1 - Language Recognizers#
A language recognizer is a device that determines if a string of characters is a part of a language.
3.2.2 - Language Generators#
A language generator is a device that can be used to generate the sentences of a language.