Answer the question
In order to leave comments, you need to log in
How to translate a string into a formula in Java?
Hello, I want to make a program that reads a line (formula), what needs to be done to translate this line into "computer language"?))
For example, there is such a line: "y=ln(x)+2.5*7^x" it is necessary to these actions were performed in the program. I read that this can be done using regular expressions, but did not understand how.
Answer the question
In order to leave comments, you need to log in
Ну Вы конечно насоветовали человеку ...
Если нужно запилить парсер нет ничего лучше, чем ANTLR
сами описываете грамматику, он Вам генерит код, который эту грамматику понимает. Примеров грамматик для математики вагон и маленькая тележка.
If you want to fully understand the issue - see the theory of compilers, for example, the book of the red dragon .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question