[antlr-interest] ANTLRWorks tutorial

Chaudhari, Pranita, OPEE14 Pranita.Chaudhari at eads.com
Tue Jun 5 04:26:08 PDT 2007


 
Need Help!
 
Where can I find ANTLRWorks Tutorial?
Can anybody explain how to use Debugger from ANTLRWorks and how can I run Java program on Grammer file to get output?
 
Its not available on the website:
http://www.antlr.org/error.jsp?msg=File+not+found%3A+%2Fworks%2Fhelp%2Ftutorial%2Ftutorial1.html
 
Regards,
Pranita 
________________________________

Von: antlr-interest-bounces at antlr.org im Auftrag von antlr-interest-request at antlr.org
Gesendet: Di 05.06.2007 12:05
An: antlr-interest at antlr.org
Betreff: antlr-interest Digest, Vol 31, Issue 11



Send antlr-interest mailing list submissions to
        antlr-interest at antlr.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.antlr.org/mailman/listinfo/antlr-interest
or, via email, send a message with subject or body 'help' to
        antlr-interest-request at antlr.org

You can reach the person managing the list at
        antlr-interest-owner at antlr.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of antlr-interest digest..."


Today's Topics:

   1. Re: How to resolve the left-recursion problem? (John B. Brodie)
   2. Suggestion (Phil Oliver)
   3. Re: Tree walker exception handling (Cameron Esfahani)
   4. What are channels and what are they used for? (Luke A. Guest)
   5. Help Please! (ali azimi)
   6. Re: Help Please! ( F?rat K???K )
   7. Help Please! (ali azimi)


----------------------------------------------------------------------

Message: 1
Date: Mon, 04 Jun 2007 22:32:42 -0400
From: "John B. Brodie" <jbb at acm.org>
Subject: Re: [antlr-interest] How to resolve the left-recursion
        problem?
To: yiqing at objectivity.com
Cc: antlr-interest at antlr.org
Message-ID: <E1HvOqg-00012y-00 at gecko>

Greetings!

>I need to write a parser rule for an extended class attribute namme
>expression. It could be simply a single attribute name with the class scope
>as option (persion::name) or a series of attribute names chained by "." (ie,
>"employer.ceo.name": "ceo" is an attribute of "employer" corresponded class.
>"name" is an attribute of "ceo" corresponded class).

does this work for you?

attribute_expression : NAME ( ( '::' NAME ) | ( '.' NAME )+ )? ;

(e.g. either we have a single pair of NAMEs separated by :: or we have a list
of names separated by a . or we have just a single NAME)

>I wrote the parser rules as following which contains left-recursion. I do
>not know how to resolve this problem without changing the semantic. I would
>appreciate if anyone could help.
>
>-----------------------------------------------------
>attribute_expression
>  : attribute_name
>  | dot_operator_exp
>  ;
>
>dot_operator_exp
>  : attribute_expression DOT attribute_name
>  ;
>
>attribute_name
>  : n1:NAME (SCOPE n2:NAME)?
>  ;
>------------------------------------------------------

these rules seem (to me) to permit phrases such as
   a.b::c.d.e::f.g
or
   h.i::j
or
   k::l.m

is this later stuff what you want? (e.g. any sequence of dot separated names
which are in turn separated by '::')

if so maybe try these two rules

attribute_expression : dotted_name_list ( SCOPE dotted_name_list )* ;
dotted_name_list : NAME ( DOT NAME )* ;

All of the above are UNTESTED, sorry; but I hope this helps...
   -jbb


------------------------------

Message: 2
Date: Mon, 04 Jun 2007 22:44:27 -0400
From: Phil Oliver <antlr at olivercomputing.com>
Subject: [antlr-interest] Suggestion
To: Antlr-interest at antlr.org
Message-ID: <20070605040037.804583C6010D at newmach.olivercomputing.com>
Content-Type: text/plain; charset=us-ascii; format=flowed;
        x-avg-checked=avg-ok-E842D67

Referring to a fragment rule in a parser rule (rather than a lexer
rule) appears to be an error (if not please correct me.) However,
such usage is not flagged as an error currently - it would be helpful
if it were.



------------------------------

Message: 3
Date: Mon, 4 Jun 2007 19:49:47 -0700
From: Cameron Esfahani <dirty at apple.com>
Subject: Re: [antlr-interest] Tree walker exception handling
To: Loring Craymer <lgcraymer at yahoo.com>
Cc: antlr-interest at antlr.org
Message-ID: <D9CC894E-964F-4DBD-A8F5-D10E1635EB2A at apple.com>
Content-Type: text/plain; charset="us-ascii"

Thanks.  That helped a lot.

And based on my requirements, I decided to move the symbol validation 
code back into the parser.  It has access to information that the 
tree walker doesn't.

Now I'm trying to figure out how to manage the information/object 
sharing that's going to have to happen between my parser, tree walker 
and the utility classes I'm creating.

Does anyone have any suggestions on how best to handle this?

To give a concrete example, I want to print out an error when the 
parser finds an undefined symbol.  Right now I can print out the 
symbol name and line number, but I want to print out the file name.  
The ANTLRFileStream class has getSourceName() which I want to use, 
but I'm not sure how to get to it.  It's created in my main program.  
So short of passing it, or my main class object into my parser, I 
don't know how to get to it.

On May 25, 2007, at 1:21 PM, Loring Craymer wrote:

> Take a look at Ter's ErrorManager.java in the tool
> directory.  It has a lot of extraneous stuff (as far
> as your application is concerned), but is not a bad
> model for error accumulation and reporting.  Throwing
> exceptions for semantic errors is not user-friendly:
> you really want to report back as many semantic
> problems as the user can handle, not just the first
> one.
>
> --Loring
>
> --- Cameron Esfahani <dirty at apple.com> wrote:
>
>> I know the questions are a bit open-ended, but does
>> anyone have any
>> suggestions?
>>
>> On May 22, 2007, at 5:25 PM, Cameron Esfahani wrote:
>>
>>> I'm developing a language that supports assignment:
>>>
>>> foo = 125
>>> bar = foo + 1
>>>
>>> Obviously, I need to create a symbol table to hold all of the
>>> assignment operations, and then validate all symbols against that
>>> table.
>>>
>>> From what I can tell, I should be doing this in a tree walker
>>> pass.  The problem I'm having is, what do I do when I find a
>>> logical versus syntactical error?  For example, when the user
>>> erroneously supplies a symbol that doesn't exist?
>>>
>>> Right now, I'm just throwing a RecognitionException from within the
>>> relevant tree walker rule, and I have a @rulecatch which grabs this:
>>>
>>> @rulecatch {
>>>     catch ( RecognitionException e ) {
>>>             System.exit( 0 );
>>>     }
>>> }
>>>
>>> I call System.exit() because I don't want the exception stack frame
>>> printing out.  It would scare my users.
>>>
>>> In the handler, I want to print out some useful information, like
>>> the name and line number of the undefined symbol. Can I still get
>>> this lexer information from a tree walker?
>>>
>>> Is it appropriate to use the RecognitionException for these kind of
>>> logical errors?  I'm almost wondering if I should create my own
>>> class of errors and then throw them as appropriate.
>>>

Cameron Esfahani
dirty at apple.com

"You only live once, and the way I live, once is enough"

Frank Sinatra



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070604/669ec2d6/attachment-0001.html

------------------------------

Message: 4
Date: Tue, 05 Jun 2007 07:20:57 +0100
From: "Luke A. Guest" <laguest at archangeli.co.uk>
Subject: [antlr-interest] What are channels and what are they used
        for?
To: ANTR Interest <antlr-interest at antlr.org>
Message-ID: <1181024458.7226.0.camel at rogue>
Content-Type: text/plain

Hi,

I think the subject says it all really, I have come across it, but don't
know what it's all about? Can anyone enlighten me?

Thanks,
Luke.




------------------------------

Message: 5
Date: Tue, 5 Jun 2007 01:16:40 -0700 (PDT)
From: ali azimi <aliaazimi at yahoo.com>
Subject: [antlr-interest] Help Please!
To: antlr-interest at antlr.org
Message-ID: <738619.85488.qm at web58106.mail.re3.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

Dear all,
 
where can I download "org.antlr.runtime.*" package from?

Regards,
  
  Al the Beginner



---------------------------------
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070605/5b76941b/attachment-0001.html

------------------------------

Message: 6
Date: Tue, 5 Jun 2007 11:23:38 +0300
From: " F?rat K???K " <firatkucuk at gmail.com>
Subject: Re: [antlr-interest] Help Please!
To: "ali azimi" <aliaazimi at yahoo.com>
Cc: antlr-interest at antlr.org
Message-ID:
        <7385e6fe0706050123l70e6fb8y3482813b137d9bc7 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-9; format=flowed

antlrv3 jar package includes this.
http://www.antlr.org/download/antlr-runtime-3.0.jar

2007/6/5, ali azimi <aliaazimi at yahoo.com>:
> Dear all,
>
> where can I download "org.antlr.runtime.*" package from?
>
> Regards,
>
> Al the Beginner
>
>
>  ________________________________
> Need Mail bonding?
> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
>
>


--
??r. G?r. F?rat K???K
ADAMYO Distance Learning
SAKARYA University / TURKEY

------------------------------

Message: 7
Date: Tue, 5 Jun 2007 03:05:23 -0700 (PDT)
From: ali azimi <aliaazimi at yahoo.com>
Subject: [antlr-interest] Help Please!
To: antlr-interest at antlr.org
Message-ID: <191451.50162.qm at web58105.mail.re3.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

Dear all,
  Where can I download org.antlr.runtime.* package from?
  Regards
  Al

      
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
 Play Sims Stories at Yahoo! Games.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070605/07615604/attachment.html

------------------------------

_______________________________________________
antlr-interest mailing list
antlr-interest at antlr.org
http://www.antlr.org/mailman/listinfo/antlr-interest


End of antlr-interest Digest, Vol 31, Issue 11
**********************************************


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070605/95e720da/attachment-0001.html 


More information about the antlr-interest mailing list