Concepts of PLs Definitions Flashcards
Syntax (of a PL)
The form of its expressions, statements, and program units
Semantics (of a PL)
The meaning of the syntax (the expressions, statements, and program units)
Sentences
Also called statements; the strings of a language
Lexemes
Lowest-level syntactic units
Examples: numeric literals, operators, special words, etc.
Identifiers
A group formed by lexemes;
A token that can have lexemes, or instances
Examples: names of variables, methods, classes, etc.
Token (of a PL)
The name of a lexeme group; a category of its lexemes
Recognition
–
Generation
Grammars
The formal language generation mechanisms
Backus-Naur Form (BNF)
- a way to describe syntax of a PL
- uses natural notation
- nearly identical to context free grammars (also, just “grammars”)
- “BNF” and “grammar” are used interchangeably
- a metalanguage for PLs
Context-free grammars
Metalanguage
A language used to describe another language
Left-hand side (LHS)
The abstraction being defined; text left side of the arrow
Right-hand Side (RHS)
The definition of the LHS; consists of some mixture of tokens, lexemes, references to other abstracts
Rule (production)
LHS -> RHS; the total definition