ANSWERS (ALREADY GRADED A+)
lexeme - ANSWER-The sequence characters matching a pattern
tokens - ANSWER-In lexical analysis, the compiler scans the source code from left‐to‐
right, character‐by‐character, and groups these characters into lexemes, and outputs a
sequence of ______ to the syntax analyzer
keywords - ANSWER-lexeme: if, while, ...
operators - ANSWER-lexeme: <=, ||, *, +, ...
identifiers - ANSWER-lexeme: i, i1, j1, sum...
numbers - ANSWER-lexeme constants: 12, 3.14...
(a|b)* - ANSWER-regex: All strings of a's and b's (e.g., aba, ababa)
x?= x | e - ANSWER-denotes L(x)U{e}, (where e is empty string) -- zero or one
occurrence of x.
Example: (0|1)?, 0?|1?
transition function d - ANSWER-Maps state/symbol pairs to states: S(set of states) x E
(set of input symbols (an alphabet)) -> state
DFA Simulation - ANSWER-Start in state s0 and follow transitions on each input
character (state doesn't change if no input character is read
syntax analyzer, parser - ANSWER-___, or ____, groups sequences of tokens from the
lexical analysis phase into phrases, each with an associated phrase type
scanner, parser - ANSWER-Step 1 of syntax analysis: Obtain tokens from lexical
analyzer (the output of the ___ is given to the ___)
grammatical - ANSWER-A lexical error is a mistake in lexeme (ex: typing esle instead of
else). A ___ error violates the rules of the language.
optimisation - ANSWER-___ improves programs by making them smaller or faster or
both (doesn't change an algorithm)
local - ANSWER-____ transformations are applied over small segments of the program.
limited benefit, low cost