in Compiler Design closed by
1,226 views
6 votes
6 votes
closed as a duplicate of: Token

Is this line  a/*b successfully generating the token's or it give lexical error ? if it is given the lexical error then why so ?


I think it will give lexical error because we don't find */ here

in Compiler Design closed by
1.2k views

3 Comments

a is definitely token here.

then /*...........*/ if there then it will not count as token.

But it can take divide sign and * separately

So, why not 4 tokens?
0
0

@srestha  what would be number of tokens if pattern is given as a/*b ;

0
0

chk here https://gateoverflow.in/193991/token

discussion going on. just follow it

1
1

1 Answer

2 votes
2 votes
I think, it gives lexical error bcz in a/*b it first scan 'a',

and after that it scan '/' then '*'. after  /* lexical analyzer consider this as a start of comment but,

it not get the end of comment it fall in infinite loop that's why it gives lexical error.

Related questions