The Gateway to Computer Science Excellence
+3 votes
210 views
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 by Loyal (5.7k points) | 210 views
0
d?
0
Explain
0

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

1 Answer

+2 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
by Loyal (5.6k points)
selected by
0
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

@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

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

 

I am asking why lexemes why not tokens?

+2

@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.

0
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?
0
ryt..:)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,644 questions
56,517 answers
195,583 comments
101,143 users