Program to implement Recursive Descent Parsing in C.

 


Code:


#include<stdio.h>

static char c[10];

char input;

void E(),EPRIME();

int main()

{

    printf("Enter a String: ");

    scanf("%s",c);

 

    E();

    if(c[input]=='$')

        printf("Valid String\n");

    else

        printf("Invalid String\n");

    return 0;

}

 

void E()

{

    if (c[input] == 'i')

        input++;

    EPRIME();

}

 

void EPRIME()   

{

    if (c[input]== '+') {

        input++;

        if(c[input]=='i')

            input++;

        EPRIME();

    }

    else

        return;

}


Output:




Comments

Popular posts from this blog

Write A Program To Print Hello World Using Lex

Create a Student registration form using following tags form,input,textarea,button,select,optio. The registration form must consist of following information: first name,Middle name,last name, gender(use radio button),address,phone no,email id,hobbies(use checkbox),city,state,country,collage name (use dropdown menu).