Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
24 Cards in this Set
- Front
- Back
Syntax |
Form or structure of expression, statements and program units How programs in the language are built up |
|
Semantics |
Meaning of expressions, statements, and program units What programs means |
|
Sentence or statement |
String of characters over some alphabet |
|
Language |
Set of sentences |
|
Lexeme |
Lowest level of syntactic unit of language |
|
Tokens |
Category of lexemes |
|
Recognizers |
(Formal def of languages) Reads input strings over the alphabet and decides whether it belongs to the language (syntax analysis of compiler) |
|
Generators |
(Formal def of languages) Generates sentences of a language, sentence is syntactically correct by comparison with structure of generator |
|
Context-free Grammar |
(Formal methods in describing syntax) Noam Chomsky - mid 1950s Language generators - describe syntax of natural languages Class of languages - context-free languages |
|
Backus-Naur Form |
John Backus - describe Algol 58 BNF - equiv to CFG |
|
BNF fundamentals |
Uses abstraction LHS (abstraction or nonterminals) Nonterminals - enclosed in <> RHS - mixture of terminals (tokens and lexemes) and references to abstractions |
|
Grammar (BNF) |
Collection of rules |
|
Start symbol |
Special element of nonterminals |
|
Rule or production |
LHS -> RHS |
|
Syntatic list |
Described using recursion |
|
When is rule recursive? |
Recursive if LHS appears in RHS |
|
Derivation |
Repeated application of rules starting with start symbol and ending with a sentence |
|
Sentential form |
Every string in derivation |
|
Sentence |
Sentenial form that only has terminal symbols |
|
Parse tree |
Hierarchal representation of a derivation |
|
Ambiguous Grammar |
Grammar is ambiguous if it generates a sentential form that has two or more distinct parse trees |
|
Operator associativity |
|
|
Extended BNF |
Enhances readability and writability of BNF Optional [] Alternative (a|b) 0 or more repetitions {} |
|
Other variations of EBNF |
Kleene Star * 0 or more Kleene Cross + 1 or more ? 0 or 1 () for grouping Alternative RHS - separate lines : instead of -> _opt for optional _oneof for choices |