How to Compare Math Ranges?

Hi all,
I’m trying to figure out how to compare math ranges in Open edX.

The learners should be able to enter expressions like this:
((x>2) and (3>x)) or (x<5) or (x=5)
and we should test if these ranges cover the solution

This is quite tricky because they can write the ranges in different ways, for example this input should give the same result:
(3>x>2) or (x<=5)

I’m afraid my team currently lacks the necessary skills to write a Custom Javascript problems that will cover the required logic for this type of question.
How do you recommend we create such problems?
Thanks!