Lecture 2 - Lexical Analysis Flashcards

1
Q

?

is the first phase of a compiler.

WHAT IS LEXICAL ANALYSIS?

A

Lexical Analysis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

?

It takes the modified source code from language preprocessors that are written in the form of sentences.

WHAT IS LEXICAL ANALYSIS?

A

Lexical Analysis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Lexical Analysis is the ? of a compiler

Lexical Analysis

WHAT IS LEXICAL ANALYSIS?

A

first phase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

It takes the modified source code from ? that are written in the form of sentences.

Lexical Analysis

WHAT IS LEXICAL ANALYSIS?

A

language preprocessors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

?

breaks these syntaxes into a series of tokens, by removing any whitespace or commentsin the source code.

WHAT IS LEXICAL ANALYSIS?

A

Lexical Analyzer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

If the ? finds a token invalid, it generates an error.

WHAT IS LEXICAL ANALYSIS?

A

Lexical analyzer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

?

It reads character streams from the source code, checks for legal tokens, and passes the data to the syntax analyzer when it demands.

WHAT IS LEXICAL ANALYSIS?

A

Lexical analyzer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The Lexical Analyzer breaks these syntaxes into a series of ?, by removing any ?? or comments in the source code.

Lexical analyzer

WHAT IS LEXICAL ANALYSIS?

A
  • tokens
  • whitespace
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If the Lexical analyzer finds a token invalid, it generates an ?.

Lexical analyzer

WHAT IS LEXICAL ANALYSIS?

A

error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

It reads character streams from the source code, checks for ?, and passes the data to the ??* when it demands.

Lexical analyzer

WHAT IS LEXICAL ANALYSIS?

A
  • legal tokens
  • syntax analyzer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

?

is a sequence of characters (alphanumeric) in a token.

TOKENS AND LEXEMES

A

Lexemes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

?

is a basic abstract unit of meaning.

TOKENS AND LEXEMES

A

Lexemes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

?

Lexemes is a sequence of characters (?) in a token.

Lexemes

TOKENS AND LEXEMES

A

alphanumeric

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

?

There are some predefined rules for every lexeme to be identified as a ?.

Lexemes

TOKENS AND LEXEMES

A

valid token

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

?

is an object that represents something else.

TOKENS AND LEXEMES

A

Token

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

?

could be Keywords, Operators, Strings, Constants, Special Symbols, and Identifiers.

TOKENS AND LEXEMES

A

Tokens

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

?

(6) Tokens and Lexemes

TOKENS AND LEXEMES

A
  • Keywords
  • Identifiers
  • Constants
  • Strings
  • Special Symbols
  • Operators
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

?

are pre-defined or reserved words in a programming language.

TOKENS AND LEXEMES

A

Keywords

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

?

Each ? is meant to perform a specific function in a program.

TOKENS AND LEXEMES

A

Keywords - keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

?

are used as the general terminology for naming of variables, functions and arrays.

TOKENS AND LEXEMES

A

Identifiers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

?

their values can not be modified by the program once they are defined.

TOKENS AND LEXEMES

A

Constants

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

?

refer to fixed values

TOKENS AND LEXEMES

23
Q

?

They are also called as literals

TOKENS AND LEXEMES

24
Q

?

is an array of characters ended with a null character.

TOKENS AND LEXEMES

25
# **?** are always enclosed in double quotes. ## Footnote TOKENS AND LEXEMES
Strings
26
# **?** are used in programming languages having some **special meaning**, thus cannot be used for some other purpose ## Footnote TOKENS AND LEXEMES
Special Symbols
27
# **?** (6) Special Symbols | Special Symbols ## Footnote TOKENS AND LEXEMES
* Brackets * Parentheses * Braces * Comma * Semi colon * Asterisk
28
# **?** used as **array element reference** | Special Symbols ## Footnote TOKENS AND LEXEMES
Brackets
29
# **?** used to indicate **function calls and function parameters.** | Special Symbols ## Footnote TOKENS AND LEXEMES
Parentheses
30
# **?** marks the **start and end of a block of code** containing more than executable statement. | Special Symbols ## Footnote TOKENS AND LEXEMES
Braces
31
# **?** used to **separate more than one statements.** | Special Symbols ## Footnote TOKENS AND LEXEMES
Comma
32
# **?** an operator that essentially **invokes an initialization list.** | Special Symbols ## Footnote TOKENS AND LEXEMES
Semi colon
33
# **?** used to create **pointer variable** | Special Symbols ## Footnote TOKENS AND LEXEMES
Asterisk
34
# **?** are **symbols that triggers an action** when **applied to variables** and other objects. ## Footnote TOKENS AND LEXEMES
Operators
35
# **?** (3) Operators can be classified as follows | Operators ## Footnote TOKENS AND LEXEMES
* Unary Operators * Binary Operators * Ternary Operators
36
# **?** Require only single operand (e.g., increment and decrement). | Operators ## Footnote TOKENS AND LEXEMES
Unary Operators
37
# **?** Require two operands (arithmetic operators, relational operators, logical operators, etc.). | Operators ## Footnote TOKENS AND LEXEMES
Binary Operators
38
# **?** requires three operands (Conditional Operators) | Operators ## Footnote TOKENS AND LEXEMES
Ternary Operators
39
# **?** are the **notations** for describing a **set of character strings.** ## Footnote REGULAR EXPRESSIONS
Regular Expressions
40
# **?** are **used in search engines**, **search and replace dialogs of word processors** and text editors. ## Footnote REGULAR EXPRESSIONS
Regular Expressions
41
# **?** (4) Regular expression (Classification??) ## Footnote REGULAR EXPRESSIONS
1. Any **terminal symbols (e.g. empty and null)** are regular expressions. 2. The **union of two regular expressions** is also a regular expression. 3. The **concatenation of two regular expressions** is also a regular expression. 4. The **iteration or closure of a regular expression** is also a regular expression.
42
# **?** (12) Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
* asterisk * plus sign * question mark * backslash * period * caret * square brackets * dollar sign * or sign * curly brackets * parentheses * minus sign
43
# **?** match zero or more quantifier | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
asterisk
44
# **?** match one or more quantifier | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
plus sign
45
# **?** match zero or one quantifier (makes a preceding character optional) | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
question mark
46
# **?** matches any character except the newline symbol | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
period
47
# **?** negates the character | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
caret
48
# **?** match a single character | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
square brackets
49
# **?** anchor for the end of the string | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
dollar sign
50
# **?** separates a series of alternatives | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
or sign
51
# **?** used as range quantifiers | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
curly brackets
52
# **?** used for grouping characters or regular expressions | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
Parentheses
53
# **?** indicates a range in a character class | Regular Expression Basics ## Footnote REGULAR EXPRESSIONS
Parentheses