[antlr-interest] Parsing self-defined methods

Dominik Halfkann dominik.halfkann at googlemail.com
Thu May 19 05:46:17 PDT 2011


I searched for this in the mailing list, and didn't find something, although
I'm wondering why nobody had this question before:

Is it possible to define functions/methods in the DSL and let ANTLR parse
it?

Input:
int myMethod(int i) {
    return i + 2;
}

int t = myMethod(2);
print(t);

Output:
4

Can ANTLR "jump" to the method, if it's called, or do i have to make like 2
parsers, one for first searching for methods and the second one for
executing the commands? Or is there any different way on how to do such
things?

Any help is appreciated.


More information about the antlr-interest mailing list