closed by
1,235 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

closed by

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

10 votes
10 votes
3 answers
1
junaid ahmad asked Sep 28, 2017
3,747 views
When do we count ++(post increment or pre increment) as 1 or 2 token ?
7 votes
7 votes
4 answers
2
itsvkp1 asked Nov 1, 2017
3,205 views
if there is miss spelling in some keyword in a program then this misspelled keyword will be treated as lexical errors or it will be treated as a new identifier and accept...
2 votes
2 votes
1 answer
3
Manu Thakur asked Sep 26, 2017
1,537 views
This screenshot is token from the book Ullman,How can following be a lexical error? because "elipseSize" should have a token recorded as an identifier.
1 votes
1 votes
1 answer
4
sagar27 asked Sep 21, 2018
5,202 views
Find no of tokens in below program.#include<stdio.h>main(){ int I; int *pi = &I; //parent pointer scanf("%d",pi); printf("%d\n", I+5);}