//parsing (a,d,n)
#include <iostream>
using namespace std;
char getsym();
void L(char sym);
void C(char sym);
void c(char sym);
int main()
{
char nextsym;
nextsym = getsym();
cout << nextsym;
return 0;
}
char getsym()
{
static char array[20] = "(a,d,n)";
static int i = -1;
++i;
return array[i];
}
void L(char sym)
{
if (sym == '(')
{
sym = getsym();
C(sym);
}
}
void C(char sym)
{
if(sym == 'a')
{
sym=getsym();
c(sym);
}
else
cout << "Error parsing" << endl;
}
void c(char sym)
{
if(sym == ',')
{
sym=getsym();
if(sym==id)
{
sym=getsym);
c(sym);
}
}
else
cout << "ID expected" << endl;
}
Hello guys, I've got a problem , I'm trying to parse the input however a,d,n are ID's therfore how can I tell or program that they are ID's ?