5 votes 5 votes Consider the $C$ program given below: #include <stdio.h> main () { printf("This is GO mock exam\n" ); } The total number of tokens generated when this program is passed to lexical analyzer is :______. Compiler Design tbb-mockgate-4 numerical-answers lexical-analysis compiler-design + – Bikram asked May 14, 2017 • edited Sep 4, 2019 by Counsellor Bikram 589 views answer comment Share Follow See 1 comment See all 1 1 comment reply Sohail1432 commented Oct 19, 2017 reply Follow Share How to calculate Token in this Programe. Answer is 10 ,But i m not getting it.. 0 votes 0 votes Please log in or register to add a comment.
Best answer 8 votes 8 votes #include<stdio.h> is not a token, macro expansion and file inclusion are done in preprocessing stage before giving the code to compiler for lexical analysis 1 main 2 ( 3 ) 4 { 5 printf 6 ( 7 "This is GO mock exam\n" 8 ) 9 ; 10 } Total Token =10 Let me know it is correct or not. Thanks @ joshi_nitish for clearing the doubt. Rajnish Kumar 1 answered Nov 30, 2017 • selected Jan 17, 2019 by Rishi yadav Rajnish Kumar 1 comment Share Follow See all 3 Comments See all 3 3 Comments reply Aman Bisht 1 commented Dec 23, 2017 reply Follow Share I also think it should be 15...How 15 is coming 0 votes 0 votes joshi_nitish commented Dec 23, 2017 reply Follow Share #include<stdio.h> is not a token, macro expansion and file inclusion are done in preprocessing stage before giving the code to compiler for lexical analysis.. so total no. of tokens are 10 only main ( ) { printf ( "This is GoMock\n" ) ; } 6 votes 6 votes Aman Bisht 1 commented Dec 23, 2017 reply Follow Share Oh thanks :) 0 votes 0 votes Please log in or register to add a comment.