/* Generated by re2c */
#line 1 "calc_002.re"
// re2c $INPUT -o $OUTPUT 
/* re2c lesson 001_upn_calculator, calc_002, (c) M. Boerger 2006 - 2007 */
#line 19 "calc_002.re"


#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int fill(char *p, int n, char **l)
{
	while (*++p && n--) ;
	* l = p;
	return n <= 0;
}

int scan(char *s)
{
	char *p = s;
	char *l = s;
	char *q = 0;
#define YYCTYPE         char
#define YYCURSOR        p
#define YYLIMIT         l
#define YYMARKER        q
#define YYFILL(n)		{ if (!fill(p, n, &l)) break; }
	
	for(;;)
	{

#line 34 "calc_002.c"
		{
			YYCTYPE yych;
			if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
			yych = *YYCURSOR;
			switch (yych) {
				case 0x00: goto yy1;
				case '+': goto yy3;
				case '-': goto yy4;
				case '0': goto yy5;
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9': goto yy7;
				default: goto yy2;
			}
yy1:
			++YYCURSOR;
#line 52 "calc_002.re"
			{ printf("EOF\n");	return 0; }
#line 59 "calc_002.c"
yy2:
			++YYCURSOR;
#line 53 "calc_002.re"
			{ printf("ERR\n");	return 1; }
#line 64 "calc_002.c"
yy3:
			++YYCURSOR;
#line 50 "calc_002.re"
			{ printf("+\n");	continue; }
#line 69 "calc_002.c"
yy4:
			++YYCURSOR;
#line 51 "calc_002.re"
			{ printf("+\n");	continue; }
#line 74 "calc_002.c"
yy5:
			yych = *++YYCURSOR;
			switch (yych) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9': goto yy9;
				default: goto yy6;
			}
yy6:
#line 49 "calc_002.re"
			{ printf("Num\n");	continue; }
#line 93 "calc_002.c"
yy7:
			++YYCURSOR;
			if (YYLIMIT <= YYCURSOR) YYFILL(1);
			yych = *YYCURSOR;
			switch (yych) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9': goto yy7;
				default: goto yy8;
			}
yy8:
#line 48 "calc_002.re"
			{ printf("Num\n");	continue; }
#line 114 "calc_002.c"
yy9:
			++YYCURSOR;
			if (YYLIMIT <= YYCURSOR) YYFILL(1);
			yych = *YYCURSOR;
			switch (yych) {
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7':
				case '8':
				case '9': goto yy9;
				default: goto yy10;
			}
yy10:
#line 47 "calc_002.re"
			{ printf("Oct\n");	continue; }
#line 135 "calc_002.c"
		}
#line 54 "calc_002.re"

	}
	printf("OOD\n"); return 2;
}

int main(int argc, char **argv)
{
	if (argc > 1)
	{
		return scan(argv[1]);
	}
	else
	{
		fprintf(stderr, "%s <expr>\n", argv[0]);
		return 0;
	}
}
