[antlr-interest] Re: line #'s into tree

micheal_jor open.zone at virgin.net
Fri Apr 2 06:13:28 PST 2004


--- In antlr-interest at yahoogroups.com, "ksplem" <ken at i...> wrote:
> Hi,
> 
> A ANTLR newbie here. I've been working with the tool for 2 weeks now 
> and I'm very impressed at how well it works and how easy it is to 
> use. Kudos to the development team! I already have the basics of my 
> compiler working already .NET executables that actually run ;>). I'm 
> targetting .net using .Emit calls with the implementation in C#.

What does your compiler do?. What language is it for?

> What I'm looking for is a hint on the best way to get a token's or 
> parser sentence's line number into the tree (e.g. anAST.getLine() 
> perhaps?). From my limited understanding, it seems that I might have 
> to override one or more classes perhaps ASTFactory and ASTNode 
> (sp?). 

You may want to search the archives before posting (even if Yahoo
Groups' search feature *sucks* big time). Anyway, here's a post you
may have found that is relevant to your query:
    http://groups.yahoo.com/group/antlr-interest/message/7078

Before you do anything though, have a look at the 2.7.3 release notes
for C# in:
    http://www.antlr.org/blog/CHANGES-2.7.3.txt

This bit from the release notes is relevant. It basically means that
you do not need to override makeToken()/nextToken() anymore in your lexer:
    "c) CharScanner.cs: makeToken(int) now calls setFilename(string)
on newly created tokens"

Cheers,

Micheal
ANTLR/C#




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list