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


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

int scan(char *s, int l)
{
	char *p = s;
	char *q = 0;
#define YYCTYPE         char
#define YYCURSOR        p
#define YYLIMIT         (s+l+2)
#define YYMARKER        q
#define YYFILL(n)		{ printf("OOD\n"); return 2; }
	
	for(;;)
	{

#line 26 "calc_003.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 44 "calc_003.re"
			{ printf("EOF\n");	return 0; }
#line 51 "calc_003.c"
yy2:
			++YYCURSOR;
#line 45 "calc_003.re"
			{ printf("ERR\n");	return 1; }
#line 56 "calc_003.c"
yy3:
			++YYCURSOR;
#line 42 "calc_003.re"
			{ printf("+\n");	continue; }
#line 61 "calc_003.c"
yy4:
			++YYCURSOR;
#line 43 "calc_003.re"
			{ printf("+\n");	continue; }
#line 66 "calc_003.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 41 "calc_003.re"
			{ printf("Num\n");	continue; }
#line 85 "calc_003.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 40 "calc_003.re"
			{ printf("Num\n");	continue; }
#line 106 "calc_003.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 39 "calc_003.re"
			{ printf("Oct\n");	continue; }
#line 127 "calc_003.c"
		}
#line 46 "calc_003.re"

	}
	return 0;
}

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