Fwd: CD lab program's 1 & 2

7 views
Skip to first unread message

Patlolla Akhila

unread,
Jan 31, 2015, 3:45:55 AM1/31/15
to csea...@googlegroups.com, jaya sree, Shireesha Adhikari, Abhishek Kumar, karthik rao, Sindhu Kamini, kiran mai, amulya prem, Farzana Banu, Raju Powar, teju reddy, Lekha Singhal

---------- Forwarded message ----------
From: Arifa Tehseen <arifa....@gmail.com>
Date: Sat, Jan 31, 2015 at 2:14 PM
Subject: Fwd: CD lab program's 1 & 2
To: akhilapa...@gmail.com



%{
#include <stdio.h>
%}
%%
int|float|char|double|while|for|do|if|break|continue|void|switch|case|long|struct|const|typedef|return|else {printf("%s is a keyword",yytext);}

[a-zA-Z][a-zA-Z0-9]*    printf("Identifier %s ", yytext);

[0-9]*                  printf("Digit   %s", yytext); 
   
\+                     printf("Addition Operator ");
\-                      printf("Subtract Operator ");
\{                      printf("OPENING BRACE ");
\}                      printf("ENDING BRACE ");
;                       printf("SEMICOLON ");
\/\*                     printf("COMMENT ");
\n                      printf("\n");
[ \t]+                  /* ignore whitespace */;
%%
 int main (void) {yylex(); return 0;}

 int yywrap (void) {return 1;}





lexanalysis.cpp

Patlolla Akhila

unread,
Mar 27, 2015, 12:12:29 PM3/27/15
to csea...@googlegroups.com, jaya sree, Shireesha Adhikari, Abhishek Kumar, karthik rao, Sindhu Kamini, kiran mai, amulya prem, Farzana Banu, Raju Powar, teju reddy, Lekha Singhal





%{
#include <stdio.h>
%}
%%
int|float|char|double|while|for|do|if|break|continue|void|switch|case|long|struct|const|typedef|return|else {printf("%s is a keyword",yytext);}

[a-zA-Z][a-zA-Z0-9]*    printf("Identifier %s ", yytext);

[0-9]*                  printf("Digit   %s", yytext); 
   
\+                     printf("Addition Operator ");
\-                      printf("Subtract Operator ");
\{                      printf("OPENING BRACE ");
\}                      printf("ENDING BRACE ");
;                       printf("SEMICOLON ");
\/\*                     printf("COMMENT ");
\n                      printf("\n");
[ \t]+                  /* ignore whitespace */;
%%
 int main (void) {yylex(); return 0;}

 int yywrap (void) {return 1;}





--
Hi.... visit again soon for more updates
---
You received this message because you are subscribed to the Google Groups "CSE.A JBIT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cseajbit+u...@googlegroups.com.
To post to this group, send email to csea...@googlegroups.com.
Visit this group at http://groups.google.com/group/cseajbit.
For more options, visit https://groups.google.com/d/optout.

lexanalysis.cpp
Reply all
Reply to author
Forward
0 new messages