parser for c language help me

--------------------------------------------------------------------------------

i want parser in language


i have grammer is that

SS->AAaBBb

AA->a|b

BB->aAA

this a letter for language a ,b



Code:
int lexan()
{
int lookahead;

lookahead=getchar();

return t;
}
int match(int t)
{
if(lookahead==t)
lookahead=lexan();
else error();
return lookahead;
}
void error()
{
printf(" error syntax");
}
void SS()
{
AA();
if(lookahead=='a')
match('a');
else error();
BB();
if(lookahead=='b')
match('b');
else error();
}

void AA()
{
if(lookahead=='a')
match('a');
else error();

if(lookahead=='b')
match('b');
else error();

}
void BB()
{
if(lookahead=='a')
match('a');
else error();
AA();
}

Last edited by shabbir; 30May2008 at 08:53.. Reason: Code block