[antlr-interest] [c target] templates

Jim Idle jimi at temporal-wave.com
Wed Oct 22 09:56:41 PDT 2008


On Wed, 2008-10-22 at 17:45 +0200, Heinrich du Toit wrote:

> Hi
> 
> It seems that if you have template in the .g file the C target doesn't work.


Templates are only supported by object oriented languages; at least for
the moment.

> 
> Is it possibly to still hack into the token stream somehow and add a few 
> additional "tokens"..
> and hopefully write the file out again in modified form?

StringTemplate is a convenience and design feature, it isn't needed for
any kind of functionality. It is just often a neater way to separate
your parsing code and output.

> 
> I think it should be, would appreciate it if somebody just tell me where 
> to look.

Perhaps it would be easier if you gave an example of what you want to
do. The text is available to your code, so you can do anything. Have a
look through the C examples for the basics and the C API for the rest.

> 
> Another question...
> Are the tokens in the token stream and in the tree the same tokens?


The tokens are the same, but they are carried around as payloads in tree
nodes. 

Jim

> 
> Thanks
> Heinrich
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081022/4648fadc/attachment.html 


More information about the antlr-interest mailing list