Esempio n. 1
0
void parser_t::numend(string& expString)
{
	parsetree.push(NT_NumEnd);
	switch(scanner.next_token())
	{
	case T_openparen:
		//cout <<"here";
		eat_token(T_openparen);
		expString += "(";
		//cout<< "ga";
		expString += expression();
		//cout <<"wtfffff";
		eat_token(T_closeparen);
		expString += ")";
		break;
	case T_m:
		eat_token(T_m);
		eat_token(T_opensquare);
		expString += "m[";
		expString += expression();
		eat_token(T_closesquare);
		expString += "]";
		break;
	case T_num:
		//cout <<"num found";
		eat_token(T_num);
		expString += scanner.numString();
		break;
	default:
			syntax_error(NT_NumEnd);
			break;
	}
	parsetree.pop();
}
Esempio n. 2
0
void parser_t::jump()
{
	parsetree.push(NT_Jump);
	string jto;
	switch (scanner.next_token())
	{
	case T_goto:
		eat_token(T_goto);
		eat_token(T_num);
		jto = scanner.numString();
		jumpImouto();
		outSave += "goto label" + jto;
		break;
	default:
		syntax_error(NT_Jump);
		break;
	}
	parsetree.pop();
}
Esempio n. 3
0
void parser_t::label()
{
	parsetree.push(NT_Label);
	switch(scanner.next_token())
	{
	case T_label:
		
		eat_token(T_label);
		scanner.next_token();
		outSave += "label" + scanner.numString() + ":";
		eat_token(T_num);
		eat_token(T_colon);
		break;
	default:
		syntax_error(NT_Label);
		break;
		
	}
	parsetree.pop();
}