Compilers - Lexical Analysis

0.0(0)
Studied by 4 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/31

flashcard set

Earn XP

Description and Tags

Last updated 3:53 AM on 3/10/23
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

32 Terms

1
New cards
Lexical Analysis
convert a text source program into tokens
2
New cards
Syntactic Analysis
Convert a token stream into a arse tree
3
New cards
Semantic Analysis
Enforce semantic rules and convert a parse tree into an intermediate form
4
New cards
whitespaces, comments, lexical
Lexical analysis discards (), discards (), and detects () errors
5
New cards
token
basic building block of a program
6
New cards
tedious, difficult, prone, separate
Lexical Analyzers are (tedious/engaging) to write, (easy/difficult) to extend, error (prone/resilient), and hard to (separate/merge) patterns and processing
7
New cards
Regular Languages
WE want to express the patterns of token classes as (two words)
8
New cards
character, empty, concatenation, alteration, Kleene star
Regular languages include:

a ()

the () string

the () and () of two strings

an RE followed by the (two words) meaning 0 or more repetitions of
9
New cards
a?
means 0 or 1 instance of a in regular expressions
10
New cards
a+
means 1 or more instance of a in regular expressions
11
New cards
\[abc\]
means any 1 instance of a, b, or c
12
New cards
formal language
(two words) categories can be organized in a hierarchy according to the kinds of languages they can describe (and their parsing complexity, required resources, etc. )
13
New cards
terminal, non-terminal, production rules, start symbol
a Grammar specification includes

a set of () symbols

a set of () symbols

a set of (two words)

a () symbol
14
New cards
2,4,3,1
Order the following in descending order

1 regular

3 Context Free

4 Context sensitive

2 Recursively enumerable
15
New cards
recursion
Something that separates RE’s from CFG’s is that there is no () in RE’s
16
New cards
Finite Automaton
(two words) is convertible into scanning program in a simple, mechanical way
17
New cards
alphabet, states, edges, start state, accepting states
A Finite Automaton consists of

a finite set of symbols, known as a/an ()

a finite set of ()

a finite set of () - which go from one state to another, and is labeled with a symbol

One state known as the (two words)

a subset of states known as the (two words)
18
New cards
finite, start, symbol,
An FA scans a () input string by

starting in the () state

For each successive () in the input string, transmitting along an edge from the current state that is labeled with the (same as exactly before)

Or at any time transiting along an accessible edge labeled with ε
19
New cards
all, accept, accepts, rejects
After () symbols are consumed, if the current state is a () state, the FA () the input, otherwise it () the input
20
New cards
Language
a set of strings accepted by a FA is said to be a ()
21
New cards
Infinite
All FA are finite, and any language accepted by an FA can be ()
22
New cards
2, same, epsilon
A deterministic FA demands

No () edges from a state can have the () symbol

No edge is labeled with ()
23
New cards
one, same, epsilon
Non-deterministic FAs

at least () start state has at least two edges going to different other states and bearing the () symbol

At least one edge is labeled with ()
24
New cards
does not
Being non-deterministic (does/does not) increase the descriptive power of a FA
25
New cards
guessing
No computers have good () hardware
26
New cards
e-closure
when converting an NFA to a FA, keeping track of whichever state the NFA might be in at any point is done with
27
New cards
O(n)
the time complexity for a DFA accepting a string is ()
28
New cards
Lexical Analyzer Generator
(three words) is a program that mechanically converts a set of REs into a program
29
New cards
1975
Lex was developed in ()
30
New cards
flex
whats the lexical analyzer that we use in this class
31
New cards
processing routine
in flex, each token category has its own (two words)
32
New cards
regular expressions
in flex, token formats are expressed as (two words)