Monthly Archive: December 2014
This is the Java Program to Concatenate two strings using TCP,the client sends two strings to the server where these two strings are concatenated and sent back to the client Client Program: ChatClient.java [cc...
This is the lex program to accept class of strings without having the substring bb Lex Program: [cc lang=”c”] %{ #include #include “y.tab.h” %} %% [a-zA-Z0-9]*[b]{2,2}[a-zA-Z0-9]* return VL; [a-zA-Z0-9]* return ER; %% [/cc] YACC...
This is the yacc program to validate variable declaration syntax and semantics using regular expressions Lex Program: [cc lang=”c”] %{ #include #include “y.tab.h” %} %% int|float|char return BUILTIN; “,” return COMMA; “;” return SC;...
This is the Lex Program to identify tokens in a program using regular expressions [cc lang=”c”] %{ #include %} %% bool|int|float printf(“Keyword”); [-,+]?[0-9]+ printf(“Constants”); [,.’”]+ printf(“Punctuation Chars”); [!@#$%^&*()]+ printf(“Special Chars”); [a-zA-Z]+ printf(“Identifiers”); %% main(){yylex();}...
This is the symbol table implementation in yacc using regular expressions,it checks for redeclaration of variables and multiple declarations of variables Lex Program: [cc lang=”c”] %{ #include “y.tab.h” extern char * yylval; int x=0;...
This is the lex program to check parenthesis matching,it checks whether left parenthesis or right parenthesis is missing [cc lang=”c”] %{ #include int l=0,r=0,cbl=0,cbr=0; %} %% [(] l++; [)] r++; [{] cbl++; [}] cbr++;...
This is the lex program to check whether the given string is palindrome or not. [cc lang=”c”] %{ #include char num,temp[100]; int rev=0; char arr[100]; %} %% . scanf(“%s”,arr); temp=arr; while(temp!=0){rev=rev*10+(temp%10); temp/=10;} if(rev==num) printf(“PALI”);...
This is the lex program to identify the type of number using regular expressions [cc lang=”c”] %{ #include int a=0,b=0,c=0,d=0; %} %% [+]?[0-9]+ {printf(“Postive Integer %d”,a);a++;} [-]{1}[0-9]+ {printf(“Negative Integer %d”,b);b++;} [+]?[0-9]+[.]{1}[0-9]+ {printf(“Postive Fraction %d”,c);c++;}...
The File Transfer Protocol (FTP) is a standard network protocol used to transfer computer files from one host to another host over a TCP-based network, such as the Internet. FTP is built on a...
Yacc program to identify function declaration syntax and semantics using regular expressions Lex Program: [cc lang=”c”] %{ #include #include “y.tab.h” %} %% void|int|float|char return BUILTIN; , return COMMA; ; return SC; n return NL;...
Recent Comments