1,019 views
10 votes
10 votes
a = 1+1+1+ 1+1+1 1+1;

as far as i think, it will pass the lexical phase.. it should b syntax error.. correct ??

2 Answers

Best answer
14 votes
14 votes

Yes, It will pass the lexical phase. 

There is a specific rule in "integer constant creation" that you can not have a blank space between a number.

In the above line after 5th 1, "1 1", cause an error.  This error is a grammatical error. Hence It will be not pass syntax analysis. Hence syntax error will be generated and reported at compile time. 

selected by
2 votes
2 votes
Yes , this error will be generated at the time of syntax analyzer . you cant make a parse tree for this

Related questions

0 votes
0 votes
3 answers
1
VJ2793 asked Feb 12, 2019
638 views
fro(int I=0; I <5;I++);what kind of compilation error is this ?
1 votes
1 votes
1 answer
2
1 votes
1 votes
1 answer
3
rahul sharma 5 asked Apr 28, 2018
1,416 views
int a = b+*/c;Which phase will give the error?Lexical or syntax?
0 votes
0 votes
1 answer
4
Riya Roy(Arayana) asked Jan 4, 2016
324 views
The given statement has what type of error ?in /* declare variable */ x;