This is not exactly rocket science: The point is that you can write code like this:
add(1,2,3,4,5)
And parsing that will call the Java method "add" which looks like this:
public Integer add(Integer...arguments) {
Integer sum = new Integer(0);
for (Integer x : arguments) {
sum+= x;
}
return sum;
}
}
So if you need a simple interface language over Java methods, you could use this approach.
ANTLR parse code (not that beautiful).
The ANTLR Parser Generator.
Good luck with your parser.
0 comments:
Post a Comment