[antlr-interest] Problems with token class-type override feature (with C# codegen)

Ric Klaren klaren at cs.utwente.nl
Tue Jul 30 02:17:32 PDT 2002


On Sat, Jul 27, 2002 at 08:32:38AM -0000, micheal_jor wrote:
> While exploring the idea of custom AST classes, I noticed that the 
> feature is supposed to that allow me to specify alternative AST 
> classes on a per-token basis isn't working.

If you started with the java codegen as basepoint for c# then this does not
surprise me :)

> I specified the following in my grammar but in the generated code the 
> default AST class type is still used for all nodes. There is no 
> reference to the specified class type at all.
>     tokens
>     {
>       LOCK_STMT<AST=LockStatement>;
>     }
> I though it might be related to the fact that I use manual 
> treebuilding commands such as:
> ..
>             { ## = #( [LOCK_STMT, "LOCK_STMT"], ##); } 
> ..

The automatic ones work (mostly) the manual syntax you use is broken. The
interface between action.g and the rest of antlr is quite flawed and even
my solution is a hack at most. (at least the interface between
codegenerator and action.g, the factory is the right thing I think)

> This is with C#. Does this feature work at all?. If it does, can 
> anyone give me a quick pointer to what I should look out for in 
> fixing the C# codegen pls (it needs an update soon anyways methinks).

Look at 2.7.2a's C++ codegenerator and action.g interface. I'm now at home
having a week off so I don't have sources handy enough to elaborate on
this. :( Next week when I get back I can give some more info if needed
(remind me though :) ).

If you do a search on action.g then you'll probably turn up a few of my
rants as well on what's broken in the interface.

    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
     Innovation makes enemies of all those who prospered under the old
   regime, and only lukewarm support is forthcoming from those who would
               prosper under the new. --- Niccolò Machiavelli


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list