Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compiler Tools Pccts > Re: YACC, ANTLR...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 66 of 135
Post > Topic >>

Re: YACC, ANTLR or PCCTS

by Isaac <isaac@[EMAIL PROTECTED] > Sep 11, 2004 at 06:52 PM

On Sun, 12 Sep 2004 01:30:24 +0200, Khamis Abuelkomboz
<khamis@[EMAIL PROTECTED]
> 
wrote:
> Hi Isaac
> 
> thank you for the feedback. I have downloaded ANTLR and tried it. I have

> here one question, how to get the location of found scopes within ANTLR,

> as example, I define a role:
> 
> ident
>    : IDENT
> {
>       printf("function name = %s, at %i.%i\n",
>             t->getText(),
>             t->get??????(),        //how to get the location in the
file?
>             t->get??????());
> }
> 
> regards
> Khamis

I believe you are looking for t->getLine() and t->getColumn().

I think there is a little housekeeping to do in order to use them.
You have to make sure that in the lexer when a \n is found,
newline() is called.  Otherwise I believe that ANTLR 2.7.4 automatically
tracks column and line information.  There may be some work to do
in order to get tabs to display proper column info.

Did you see the do***entation on www.antlr.org?

Isaac
 




 4 Posts in Topic:
YACC, ANTLR or PCCTS
khamis@[EMAIL PROTECTED]   2004-09-07 08:32:48 
Re: YACC, ANTLR or PCCTS
Isaac <isaac@[EMAIL PR  2004-09-09 20:46:35 
Re: YACC, ANTLR or PCCTS
Khamis Abuelkomboz <kh  2004-09-12 01:30:24 
Re: YACC, ANTLR or PCCTS
Isaac <isaac@[EMAIL PR  2004-09-11 18:52:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 8:20:14 CDT 2008.