1 votes 1 votes Find no of Tokens in bellow program int main() { a=b+c; "printf("%d%d%d,a,b,c")"; } nd my other doubt is if we replace a=b+c to "a=b+c or a=b+c" will it give lexical error nd if ,then in which case. Compiler Design compiler-tokenization compiler-design + – saurabh rai asked Nov 15, 2016 saurabh rai 2.9k views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply Shubham Pandey 2 commented Nov 15, 2016 reply Follow Share 14 tockens 2 votes 2 votes saurabh rai commented Nov 15, 2016 reply Follow Share ok nd for last line what will b the ans ?? 0 votes 0 votes Shubham Pandey 2 commented Nov 15, 2016 reply Follow Share it will not give lexical error 0 votes 0 votes Please log in or register to add a comment.
Best answer 12 votes 12 votes [1. int] [2.main] [3.( ] [4.) ] [5. { ] [6. a ] [7.= ] [8. b ] [9.+ ] [10.c ] [11. ; ] [12. "printf(" ] [13. % ] [14. d ] [15. % ] [16. d ][17.% ] [18.d ] [19., ] [20.a ] [ 21., ] [22. b ] [23. , ] [24.c ] [25.")" ] [26. ; ] [27. } ] when 1st " come it search for next " when it found considered as token. Prashant. answered Nov 15, 2016 • selected Nov 15, 2016 by saurabh rai Prashant. comment Share Follow See all 4 Comments See all 4 4 Comments reply Prajwal Bhat commented Nov 15, 2016 reply Follow Share @Anirudh What is the meaning of writing printf() inside the quotation? 1 votes 1 votes Prashant. commented Nov 15, 2016 reply Follow Share no meaning . lexically it pass but genrate error on syntax. 1 votes 1 votes Vaishali Trivedi commented Nov 15, 2016 reply Follow Share why it will generate error in syntax ? 0 votes 0 votes saurabh rai commented Nov 15, 2016 reply Follow Share @anirudh plzz see my other doubt (in last line ) i think it ll give lexical error. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes int main ( ) { a = b + c ; "printf(" % d % d % d , a , b , c ")" ; } I got 27 Token Himanshu Kumar Gupta answered Sep 12, 2020 Himanshu Kumar Gupta comment Share Follow See all 0 reply Please log in or register to add a comment.