4,618 views
6 votes
6 votes

Given answer is 25, while my answer is 26, they have considered -10.0 as single token, which is wrong?

1 Answer

1 votes
1 votes

Ans is 25

Sol

i think you done mistak -10.0 take tow token but only 1.

Lexical analyzer checks for a longest valid lexeme which matches the pattern in case of "<=", it is the longest valid pattern so it will see "-10.0" as one pattern (as it is also a longest valid pattern).

edited by

Related questions

3 votes
3 votes
4 answers
1
Deepak Singh 7 asked Mar 15, 2018
1,266 views
Number of tokens in $\text{int a[5];}$
2 votes
2 votes
2 answers
2
Na462 asked Nov 7, 2018
3,690 views
0 votes
0 votes
1 answer
3
syncronizing asked Sep 21, 2018
5,389 views
Question:Find the number of tokens in the following C code using lexical analyzer of the compiler.
0 votes
0 votes
2 answers
4
saumya mishra asked Jun 12, 2018
2,295 views
In this question we will take n-=n1 as n=n-n1 as 5 tokens or n-=n1 as 4 tokens ????