Basics Flashcards
the form of expressions, statements, and program units of a programming language
Syntax
the meaning of the expressions, statements, and program units of a programming language
Semantics
include the numeric literals, operators, and special words of a programming language
Lexemes
a category of the lexemes of a language
Token
reads input strings of the language and decides whether the strings belong to the language.
Language recognizer
creates sentences of a language
Language generator
describes the syntax of programming languages; a collection of rules
Grammar
describe four (4) classes of generative devices or grammars that define four (4) classes of language. Two of these grammar classes are regular and context-free grammar
Noam Chomsky
describe the forms of the tokens of the programming languages
Regular grammars
describe the syntax of whole programming languages
Context-free grammars
a natural notation for describing syntax developed by John Backus and Peter Naur in the mid-1950s
Backus-Naur Form (BNF)
a language that is used to describe another language
Metalanguage
the abstraction being defined; the text on the left-side of the arrow
Left-hand side (LHS)
the definition of LHS; the text to the right of the arrow
Right-hand side (RHS)
a mixture of tokens, lexemes, and references to other abstractions
Rule (or production)
The abstraction in a BNF description, or grammar, are called
nonterminal symbols or nonterminals
The lexemes and tokens of the rules are called
terminal symbols or terminals
A rule is recursive if
if its LHS appears in its RHS
The sentences of the language are generated through a sequence of applications of the rules, beginning with a special nonterminal of the grammar called the …
This sequence of rule applications is called a …
- start symbol
- derivation
Each of the strings in the derivation is called a …
sentential form
In leftmost derivation, the replaced nonterminal is always the leftmost nonterminal in the sentential form
true
In rightmost derivation, the replaced nonterminal is always the rightmost nonterminal
true
hierarchical syntactic structures of the sentences of the languages
Parse trees
A grammar is ambiguous if the grammar generates a sentence with more than one (1) leftmost derivation or rightmost derivation
true
When an expression includes two (2) operators that have the same precedence, a semantic rule is required to specify which should have precedence. The rule is named …
Associativity
When a grammar rule has its LHS also appearing at the beginning of its RHS, the rule is said to be …
left recursive
extended versions of BNF that increase the readability and writability of BNF
Extended BNF (or EBNF)
What are the three (3) EBNF extensions?
- Optional parts of an RHS are placed in brackets.
- Braces are used to indicate that the enclosed part can be repeated indefinitely or left out altogether.
- When a single element must be chosen from a group, the options are placed in parentheses