MultiplicationExpression::MultiplicationExpression(const Expression::Pointer&
	operand1, MultiplicationType::Types multiplication_type, const Expression::
	Pointer& operand2)
:
	Expression(ValueType::NUMBER),
	operand1(operand1),
	multiplication_type(multiplication_type),
	operand2(operand2)
{
	if (operand1->getType() != operand2->getType() || operand1->getType() !=
		ValueType::NUMBER)
	{
		throw IllegalMultiplicationOperationException(multiplication_type,
			operand1->getType(), operand2->getType());
	}

	this->operand1 = Expression::Pointer(new ParenthesesExpression(operand1));
	this->operand2 = Expression::Pointer(new ParenthesesExpression(operand2));
}
ArrayAccessExpression::ArrayAccessExpression(const Variable::Pointer& variable,
	const Expression::Pointer& index_expression)
:
	Expression(ValueType::NUMBER),
	variable(variable),
	index_expression(index_expression)
{
	ValueType::Types variable_type = ValueType::UNKNOWN_TYPE;
	if (typeid(*variable) == typeid(NumberVariable)) {
		variable_type = ValueType::NUMBER;
	} else if (typeid(*variable) == typeid(ArrayVariable) || typeid(*variable)
		== typeid(StringVariable))
	{
		variable_type = ValueType::ARRAY;
	}

	if (variable_type != ValueType::ARRAY || index_expression->getType() !=
		ValueType::NUMBER)
	{
		throw IllegalArrayAccessOperationException(variable_type,
			index_expression->getType());
	}
}