Say I have a very basic rule like the one below
if a<b
then set a=25
else set a=-25
I need to evaluate this using my Java. What is the best approach to do these kind of parsing? Using regular expression could be very difficult and will be very difficult to maintain right?
Can someone please suggest an approach? Please let me know if you need any further information.
If your syntax is regular, you can use regular expressions. If it is not, you need to use more complicated tools such as Lexers and Parsers: i.e. Antlr or Yacc/Lex/Bison.
If you don’t know much about language design, I suggest you read a book on the subject before you dive in.