Exemplo n.º 1
0
//call this syntax error when you are trying to parse the
//non-terminal nt, but you fail to find a token that you need
//to make progress.  You should call this as soon as you can know
//there is a syntax_error. 
void parser_t::syntax_error(nonterm_type nt)
{
	printf("syntax error: found %s in parsing %s - line %d\n",
		token_to_string( scanner.next_token()),
		nonterm_to_string(nt),
		scanner.get_line() ); 
	exit(1); 
}
Exemplo n.º 2
0
void parser_t::div_by_zero_error()
{
        printf("div by zero error: line %d\n", scanner.get_line() );
        exit(0);
}