C Program for implementation of language given belowE-> TE’#include<stdio.h> #include<conio.h> #include<string.h> #include<process.h> void e(); void e1(); void t(); void t1(); void f(); int ip=0; static char s[10]; void main() { char k; int i; ip=0; clrscr(); printf("enter the string:\n "); scanf("%s",s); printf("the string is : %s\n",s); e(); if(s[ip]=='$') printf("String is accepted "); getch(); } void e() { t(); e1(); return; } void t() { f(); t1(); // return; } void e1() { if(s[ip]=='+') { ip++; t(); e1(); } return; } void t1() { if(s[ip]=='*') { ip++; f(); t1(); } return; } void f() { if(s[ip]=='(') { ip++; e(); if(s[ip]==')') ip++; else printf("error closed paranthesis expected"); } else if(s[ip]=='i') ip++; else printf("id expected "); return; }
E’-> +TE’ | epsilon
T-> FT’
T’-> *FT’ | epsilon
F-> (E) | i
Tuesday, December 11, 2018
string belongs to the given grammar or not
Subscribe to:
Post Comments (Atom)
DBMS class materials click here to join the class room click here https://www.youtube.com/channel/UC93Sqlk_tv9A9cFv-QjZFAQ
-
Design LALR Bottom up Parser. <parser.l> %{ #include<stdio.h> #include "y.tab.h" %} %% [0-9]+ {yylval...
-
Lucky Gifts "Planet Kids Entertainment Fair" is back to delight kids and parents. The Fair will have non-stop entertainment w...
No comments:
Post a Comment