Парсер для context-free grammar G (JAVA)
см аттач
Задача
a5.html
TEST CODE:
----
Write a parser and interpreter for a language L(G) generated by a given context-free grammar G.
use Java
Specifically, you are to define an integer-valued function evaluate, which takes a string input and return its value if it is a well-formed string. In Java, this function should be a public method of an Interpreter class. If there is a syntactic or semantic error, the method should throw an InputMismatchException whose message is an informative error message. In Scheme, the function should deal with erroneous input by returning a string representing an informative error message. In the ill-formed case, the method (or function) needn't try to find all of the errors or correct any errors; reporting one error is sufficient.