That is exactly what it does. In a very nice way. Because the language definition and the translation and the interpretation is all in Java, there are no external BNF files of any kind. You even do not ordinarily need to generate a parse tree.
Define you grammar and semantic model together. No Foreign Code or Embedded Helper. Happy Days.
addProduction("T -> / T T", new Semantic() {
public Object evaluate(List<Object> childEvals) {
public Object evaluate(List<Object> childEvals) {
return ((BigInteger) childEvals.get(1)).divide((BigInteger) childEvals.get(2));
}
}
});
No comments:
Post a Comment