I'm currently thinking about how best to take the AST generated by Antlr and convert it to useful objects that I can use in my program.
The purpose of my grammar (besides learning) is to create an executable (interpreted at runtime) language.
For example, how can I take an attribute subtree and instantiate a specific attribute class. for instance
The following code is in my language:
Print(message:"Hello stackoverflow")
will produce the following AST:

Currently, I believe that a factory class can read a tree, retrieve the name ( message) and type ( STRING) (" Hello stackoverflow"). Now, knowing the type, I can create the correct class (for example, the StringAttribute class) and pass the required attribute data - nameand value.
, (Print), Print, , .
:
Program(args:[1,2,3,4,5])
{
If(isTrue:IsInArray(array:{Program.args} value:5))
{
Then {
Print(message:"5 is in the array")
} Else {
Print(message:"More complex " + "message")
}
}
}

/ . .
( ):
- LL
- Antrl3