10 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 ?? Compiler Design compiler-design lexical-analysis + – shubhams3 2.1k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply Arjun commented Mar 22, 2016 reply Follow flag yes.. All are valid tokens. 4 4 replyShare shubhams3 commented Mar 22, 2016 reply Follow flag Tokens r valid, but d code will not compile. I think d error will b in syntax analyzer phase.. No grammar will b available to construct parse tree of given string. 1 1 replyShare Please log in or register to add a comment.
Best answer 13 13 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. rude answered Mar 22, 2016 • selected May 19, 2016 by Arjun rude comment Share Follow See all 6 Comments 6 6 Comments reply Show 3 previous comments rude commented Apr 5, 2016 reply Follow flag @Arjun Sir, Is my answer is not correct? Why did I get a down vote for this? :( :( 0 0 replyShare Arjun commented Apr 5, 2016 reply Follow flag yes, its not correct. 1 1 should be two valid tokens in C. 0 0 replyShare rude commented May 19, 2016 reply Follow flag @Arjun sir, yeah i got my mistake. Now I have edited it. I think now its correct. Thx. 0 0 replyShare Please log in or register to add a comment.
2 2 votes Yes , this error will be generated at the time of syntax analyzer . you cant make a parse tree for this rishu_18 answered Mar 22, 2016 rishu_18 comment Share Follow 0 reply Please log in or register to add a comment.