I haven't written any code, but here's my thoughts. I haven't been able to
think of an approach beyond brute force, with a little 'pruning'.
Using an RPN representation is the way to go, as it simplifies the handling
of brackets (as such, they go away). Using your example, the RPN is
1 5 . 3 . 4 .
where every '.' is a place where an operator might be, except for the
right-most '.' where we know there has to be one or more operators, because
it's RPN. Every other '.' has zero or more operators. For N values you must
have N-1 operators, of course.
Now the problem splits into these parts:
1. Generate all combinations of N-1 operators (2^N)
2. For each operator combination, generate all 'fillings' of the operator
points '.', ie, group the operator list by 1s, 2s, ..., N-1s, maintaining
the operator order (my combinatorics-fu is weak, can't figure this out)
3. For each combination of combinations, evaluate the expression
The pruning occurs in the last step. As you evaluate, if the expression
value goes beyond the desired result, stop with a fail, as there are no
operators that might reduce the expression value.