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

Apply inline, internal and external style sheet for the student registration form.