This problem is kind of fitting for my screen name...C Shell...CrazyShells....yeah Im done lol.
Anyhow Im trying to write a C Shell that prints a prompt, you enter the command into stdin, and it executes it yadda yadda yadda. I just want this shell to do only one thing for now...exit, lol. Thats it however I am having some issues that are just confusing the hell out of me. Im using flex to write this also and I get errors when I flex the file, and then when I try to gcc it.
The errors are as follows:
enum token_t (PROMT, COMMAND, END);
\n return PROMT;
[a-zA-Z0-9 ]+ return COMMAND;
exit return END;
int running = 1;
print("Enter a command.");
tokentype = yylex();
running = 0;
"Shell.l", line 11: warning, rule cannot be matched
Shell.l:2: parse error before `,'
Shell.l: In function `yylex':
Shell.l:6: `PROMT' undeclared (first use in this function)
Shell.l:6: (Each undeclared identifier is reported only once
Shell.l:6: for each function it appears in.)
Shell.l:9: `COMMAND' undeclared (first use in this function)
Shell.l:11: `END' undeclared (first use in this function)
Shell.l: In function `main':
Shell.l:29: `COMMAND' undeclared (first use in this function)
Shell.l:31: `END' undeclared (first use in this function)
Shell.l:30: warning: unreachable code at beginning of switch statement
See now what irks me about this is that END, and COMMAND are clearly(I hope atleast) defined in the rules section of the flex file same thing for promt. What could I possibly be doing wrong here?