java - How to check syntax error on algebraic expression -
i've been searching method check if algebraic expression written, find "how solve thing" or "how simplify mathematica".
you'll see, have program field input string, string should
"(x-a)^2-y+2"
, , have check if it's correct, if user inputs like:
- ")x-4(+1"
- "x*"
- "4-9)6"
- "+*--*7" ...etc, have it's wrong , try again. don't need result, or evaluate on x or anything, that. knows how this? appreciate help.
mathematica, wxmaxima, maple, etc. use syntax tree. define grammar , parse expression using grammar. furthermore type checking done.
one can generate java-parser using yacc or bison.
Comments
Post a Comment