Sharecodepoint App Download Qrcode Sharecodepoint Android App Banner
Now You can search anything in sharecodepoint using your voice. Click on mic button. Sharecodepoint Voice Sharecodepoint Youtube Channel



Sharecodepoint popular queries

Saturday, 23 February 2019

Program to count the no of comment line in a given C program. Also eliminate them and copy that program into separate file . | Compiler Design Lab Programs | Lex Programs


Compiler Design Lap Program :

%{
 #include<stdio.h>
 int com=0;
%}
%s COMMENT
%%
“/*”[.]*”*/” {com++;}
“/*” {BEGIN COMMENT ;}
<COMMENT>”*/” {BEGIN 0; com++ ;}
<COMMENT>\n {com++ ;}
<COMMENT>. {;}
.|\n {fprintf(yyout,”%s”,yytext);
%%
int yywrap()
{
return 1;
}
main(int argc, char *argv[])
{
 If(argc!=2)
 {
 printf(“Usage: <./a.out> <sourcefile> <destn file>\n”);
 exit(0);
 }
 yyin=fopen(argv[1],”r”);
 yyout=fopen(argv[2],”w”);
 yylex();
 printf(“No of comment lines=%d\n”,com);

0 comments:

Post a Comment

 

Version 23.2.3.4 - 2016 - 2019 - © Sharecodepoint | Made in India. | Copyright Content