%{
#define TOKEN_GARBAGE  1
#define TOKEN_PROGRAM  2
#define TOKEN_BEGIN    3
/* and so on */
%}

%%
"program"	{ return TOKEN_PROGRAM; }
"begin"		{ return TOKEN_BEGIN; }
[ \t\n]+	/* ignore whitespace */
.		{ return TOKEN_GARBAGE; }
%%
int main()
{
	int token;

	while(token = yylex())
		    printf("got token #%d\n", token);
}
