in Compiler Design
2,133 views
3 votes
3 votes
In the Lexical Analysis, regular expression can be used to model

A) the structures of lexemes with fixed length identifier excluded
B) the structure of tokens
C) the structure of tokens but not lexemes
D) the structure of lexemes with variable length identifier included
in Compiler Design
2.1k views

3 Comments

d?
0
0
Explain
0
0

@Prince Sindhiya I have explained it in the ans... Pls correct me if I am wrong

0
0

2 Answers

4 votes
4 votes
Best answer
Lexical Analysis deals with lexems and the length of an identifier is not defined in the programming languages mostly... i.e as such there is no constraint on the length of the identifiers so In the Lexical Analysis, regular expression can be used to model the structure of lexemes with variable length identifier included.

So option d
selected by

6 Comments

Why it can't be -> in Lexical Analysis, regular expression can be used to model the structure of tokens with variable  length identifier included.

Ex- int value =4;

For variable length identfier --value

Token is <id , 1>
0
0

@Prince Sindhiya as the length of the identifier is not fixed that is why we take variable length identifier... Sorry I am not getting what u are trying to ask .. can u pls elaborate ur doubt

0
0

 to model the structure of tokens with variable  length identifier included.

 

I am asking why lexemes why not tokens?

0
0

@Prince Sindhiya at lexical analysis phase we are dealing with lexems after analysis of lexemes we get tokens.A lexeme is a sequence of characters in the source program that matches the pattern for a token and is identified by the lexical analyzer as an instance of that token. A token is a pair consisting of a token name and an optional attribute value.

3
3
Ok means regular expression can be used to model lexemes then lexemes are used in construction of tokens in which  lexemes are mapped into tokens ryt?
1
1
ryt..:)
0
0
0 votes
0 votes
option D)the structure of lexemes with variable length identifier included.

Related questions