[antlr-interest] advocacy of C++ support in ANTLR 3.x

Gavin Lambert antlr at mirality.co.nz
Wed Apr 2 13:34:17 PDT 2008


At 09:10 3/04/2008, Jim Idle wrote:
 >As I said, you just end up having create the structure yourself, 
I
 >already went down this path and back up.

But that's exactly what some people want -- they already have 
their own tree structures completely independent of ANTLR, and 
forcing people to use ANTLR's trees instead means they'll have to 
write a conversion layer to run afterwards instead of simply 
generating their own tree in the first place.

 >Then you cast it to whatever the user says, and they have to 
have a
 >structure that supplies the same function set anyway. However, 
done
 >this way they will need to supply all functions and not just the 

 >ones they need to override.

Not true.  If they simply want to extend the standard tree, they 
can do that by inheriting from ANTLR3_COMMON_TREE and 
ANTLR3_COMMON_TREE_ADAPTOR, and overriding the minimal set of 
methods they actually want to change.

If they want to replace the entire tree structure, then they 
ignore ANTLR3_COMMON_TREE and inherit from 
ANTLR3_BASE_TREE_ADAPTOR; this requires them to implement all 
methods, but means that their tree node could be some C++ type 
completely divorced from ANTLR -- the adaptor carries the burden 
of converting the interfaces.



More information about the antlr-interest mailing list