[antlr-interest] Re: antlr-interest Digest, Vol 12, Issue 23

nadesai at cse.iitb.ac.in nadesai at cse.iitb.ac.in
Tue Nov 15 11:16:53 PST 2005


> 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: Treeparser inheritance? (Terence Parr)
>    2. Want to change in ANTLR code (Desai Nishitkumar Ashokkumar)
>    3. Re: Want to change in ANTLR code (Terence Parr)
>    4. java.lang.InternalError (Jeff Barnes)
>    5. added template rewrite stuff to blog (Terence Parr)
>    6. RE: added template rewrite stuff to blog (Micheal J)
>    7. Re: java.lang.InternalError (Akhilesh Mritunjai)
>    8. Re: added template rewrite stuff to blog (Ahmed Mohombe)
>    9. anybody interested in writing an ANTLR article? (Terence Parr)
>   10. xml grammar (Torsten Curdt)
>   11. Re: xml grammar (Oliver Zeigermann)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 14 Nov 2005 12:06:04 -0800
> From: Terence Parr <parrt at cs.usfca.edu>
> Subject: Re: [antlr-interest] Treeparser inheritance?
> To: ANTLR Interest <antlr-interest at antlr.org>
> Message-ID: <6EA52A2E-ECD9-45C7-B0F8-7350086B8CD9 at cs.usfca.edu>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> Oh, sorry.  Now I remember.  Inheritance is an "include".  The
> implementation says it inherits from the tree parser, but you'll see
> all your overridden rules inside. :)
>
> Ter
> On Nov 14, 2005, at 11:49 AM, Jos Fries wrote:
>
>> Hi Terrence,
>>
>> Could you point me to an example in which a tree parser in a
>> subgrammar inherits from the tree parser in the supergrammer? I
>> searched in vain for that use of inheritance in the reference
>> manual...
>>
>> Regards,
>>
>> Jos
>>
>>
>>>
>>> On Nov 14, 2005, at 8:37 AM, Jos Fries wrote:
>>>
>>>> Hi,
>>>>
>>>> Last weekend I experimented with grammar inheritance. I
>>>> successfully extended a lexer and a parser. Extending my tree
>>>> parser however failed. My statement "class BTreeWalker extends
>>>> ATreeWalker;" is accepted by ANTLR but compiled to the Java code
>>>> "public class BTreeWalker extends antlr.TreeParser".
>>>>
>>>> Excuse the newbie character of the question, but does the
>>>> concept  of grammar inheritance also apply to tree parsers? The
>>>> documentation doesn't state anything about this. I'm using antlr
>>>> 2.7.4.
>>>
>>> Hi Jos, it should work as you describe.  Are you sure you're doing
>>> it just like in the examples?
>>>
>>> Terence
>>>
>>>
>>>
>>>
>>> --
>>> No virus found in this incoming message.
>>> Checked by AVG Free Edition.
>>> Version: 7.1.362 / Virus Database: 267.13.0/167 - Release Date:
>>> 11-11-2005
>>>
>>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 15 Nov 2005 02:52:06 +0530 (IST)
> From: Desai Nishitkumar Ashokkumar <nadesai at cse.iitb.ac.in>
> Subject: [antlr-interest] Want to change in ANTLR code
> To: antlr-interest at antlr.org
> Message-ID: <Pine.LNX.4.61.0511150248400.22878 at nsl-14.cse.iitb.ac.in>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
>
> Hi,
>      Suppose I have changed ANTLR file TokenBuffer.java. Now, how can I
> incorporate this new java file ?? means I want to use this new class file.
> AT which places I have to make changes ??
>
> thanks in advance.
>
>
> --
> Nishit Desai
> M.Tech II year
> Computer Science & Engg.
> IIT Bombay
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 14 Nov 2005 13:30:34 -0800
> From: Terence Parr <parrt at cs.usfca.edu>
> Subject: Re: [antlr-interest] Want to change in ANTLR code
> To: ANTLR Interest <antlr-interest at antlr.org>
> Message-ID: <648CFE55-221F-47ED-8C39-B9524CEEB831 at cs.usfca.edu>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>
> On Nov 14, 2005, at 1:22 PM, Desai Nishitkumar Ashokkumar wrote:
>
>>
>> Hi,
>>     Suppose I have changed ANTLR file TokenBuffer.java.
>
> Just put the modified TokenBuffer.class file first in your CLASSPATH
> environment variable and then it will use your version not the
> default in antlr :)
>
  Thanks sir, I have made new antlr.jar with TokenBuffer.class file and
its working.
  I want to give to antlr a new token when some mismatched token comes and
error/exception is generated. and also want to start parsing from
previous point with this new given  token.

Can u plz tell me where/which places I have to make changes. I m trying
since 2 days.

Thanks
> Terence
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 14 Nov 2005 16:11:33 -0800 (PST)
> From: Jeff Barnes <jbarnesweb at yahoo.com>
> Subject: [antlr-interest] java.lang.InternalError
> To: antlr-interest at antlr.org
> Message-ID: <20051115001133.55244.qmail at web54509.mail.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1
>
> When trying to debug the generated lexer in either
> Eclipse or NetBeans, "java.lang.InternalError: name is
> too long to represent" is thrown. It is thrown when I
> try to instantiate my lexer with the InputStream
> argument. The fully-qualified name is 34 characters
> long.
>
> Is this a known issue and is there a workaround?
>
> Regards,
> Jeff Barnes
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 14 Nov 2005 20:31:50 -0800
> From: Terence Parr <parrt at cs.usfca.edu>
> Subject: [antlr-interest] added template rewrite stuff to blog
> To: ANTLR Interest <antlr-interest at antlr.org>
> Cc: stringtemplate-interest at antlr.org
> Message-ID: <0E0160E2-21F1-4550-B65D-0FB8E0CBAEF7 at cs.usfca.edu>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> Howdy,
>
> Added my plans for implementing template rewrites to v3:
>
> http://www.antlr.org/blog/antlr3/rewrite.tml
>
> Ter
>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 15 Nov 2005 08:37:42 -0000
> From: "Micheal J" <open.zone at virgin.net>
> Subject: RE: [antlr-interest] added template rewrite stuff to blog
> To: "'ANTLR Interest'" <antlr-interest at antlr.org>
> Cc: stringtemplate-interest at antlr.org
> Message-ID: <006c01c5e9bf$d968da40$6802a8c0 at hercules>
> Content-Type: text/plain;	charset="US-ASCII"
>
>> Howdy,
>>
>> Added my plans for implementing template rewrites to v3:
>>
>> http://www.antlr.org/blog/antlr3/rewrite.tml
>
> It about time you get an RSS/ATOM-enabled blog. Just pick one of the many
> OS
> blogging packages.
>
> Micheal
>
>
>
> ------------------------------
>
> Message: 7
> Date: Tue, 15 Nov 2005 01:45:33 -0800 (PST)
> From: Akhilesh Mritunjai <virtualaspirin at yahoo.com>
> Subject: Re: [antlr-interest] java.lang.InternalError
> To: Jeff Barnes <jbarnesweb at yahoo.com>, antlr-interest at antlr.org
> Message-ID: <20051115094533.82295.qmail at web30803.mail.mud.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1
>
> Hi
>
> We are facing the same problem. The funny thing is
> that only me in my team is having this problem. I'm
> using Sun JDK/JRE 1.5 (Patchset 4) with eclipse 3.1.1
> on Windows XP. This problem was intermittent (eg it
> went temporarily when changing from 3.1 to 3.1.1), but
> again appeared.
>
> This problem does not occur when I use JRockit JRE 1.5
> for debugging! So I reckon its some specific issue
> pertaining to combination of number of above
> components.
>
> My teammates on Linux using Sun JRE 1.5_4 for Linux
> don't face this problem (may be yet!) with eclipse 3.1
>
> Google doesn't help much with this issue.
>
> - Akhilesh
>
> --- Jeff Barnes <jbarnesweb at yahoo.com> wrote:
>
>> When trying to debug the generated lexer in either
>> Eclipse or NetBeans, "java.lang.InternalError: name
>> is
>> too long to represent" is thrown. It is thrown when
>> I
>> try to instantiate my lexer with the InputStream
>> argument. The fully-qualified name is 34 characters
>> long.
>>
>> Is this a known issue and is there a workaround?
>>
>> Regards,
>> Jeff Barnes
>>
>
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>
>
> ------------------------------
>
> Message: 8
> Date: Tue, 15 Nov 2005 13:39:52 +0100
> From: Ahmed Mohombe <amohombe at yahoo.com>
> Subject: [antlr-interest] Re: added template rewrite stuff to blog
> To: antlr-interest at antlr.org
> Message-ID: <dlckup$djp$2 at sea.gmane.org>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>>>Howdy,
>>>
>>>Added my plans for implementing template rewrites to v3:
>>>
>>>http://www.antlr.org/blog/antlr3/rewrite.tml
>>
>>
>> It about time you get an RSS/ATOM-enabled blog. Just pick one of the
>> many OS
>> blogging packages.
> Yeah, AFAIK Confluence has such a support, and ANTLR had a Confluence
> license.
> Why not using it?
>
> Ahmed.
>
>
>
> ------------------------------
>
> Message: 9
> Date: Tue, 15 Nov 2005 09:38:36 -0800
> From: Terence Parr <parrt at cs.usfca.edu>
> Subject: [antlr-interest] anybody interested in writing an ANTLR
> 	article?
> To: ANTLR Interest <antlr-interest at antlr.org>
> Message-ID: <48712844-6784-416D-9491-9FE060316647 at cs.usfca.edu>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> Hi, the following tech magazine is interested in having someone do an
> article on using ANTLR:
>
>> Olga krawczyk
>> Software-Wydawnictwo Sp z o.o.
>> Product Manager
>> olga.krawczyk at software.com.pl
>> www.software.com.pl/en
>
>> we are a Polish Publishing House Software-Wydawnictwo. We publish
>> several titles in 7 different languages. we would like to propose
>> you to
>> write an article for us (the article would be published in 2
>> magazines :
>> Software Developer's Journal and SDJ Extra! and distributed in France,
>> Spain, Germany, Austria, Belgium, Switzerland and Poland).
>
> Could be interesting for someone, particular a European looking for
> good exposure :)  Please respond directly to Olga for more information.
>
> Regards,
> Terence
>
>
> ------------------------------
>
> Message: 10
> Date: Tue, 15 Nov 2005 19:13:57 +0100
> From: Torsten Curdt <tcurdt at vafer.org>
> Subject: [antlr-interest] xml grammar
> To: antlr-interest at antlr.org
> Message-ID: <7E941C19-F75D-416E-8F71-495600D3A52B at vafer.org>
> Content-Type: text/plain; charset="us-ascii"
>
> I have to cope with a pre-XML-standard so I cannot use one
> of popular parsers. I am surprised I cannot find an antlr
> XML grammar on the net.
>
> I gave it a try and I've run into some problems with the
> lexer as the lexer cannot distinguish between the literal
> that identifies a tag name or the characters inside a tag.
>
>  From the context of the token it should be obvious what it
> is.
>
> Here is what I've come up so far. Of course PIs, comments
> and DOCTYPE declarations are still missing...
>
> Anyone some insights on how to solve that?
>
> --------------
>
> header {
>      package my.package;
>      }
>
> class MyParser extends Parser;
>
> options {
> 	k=2;
> }
>
> parse
>    :
>    ( tag )+
>    ;
>
> tag
>    : LT tag1:LITERAL (COLON tag2:LITERAL)? (WS)*
>      (attr1:LITERAL (COLON attr2:LITERAL)? EQ value1:QLITERAL (WS)*
> {  } )*
>      { System.out.println("started " + tag1 + tag2); }
>      ((SLASH GT) | (GT tagbody LT SLASH LITERAL (COLON LITERAL)? GT))
>      { System.out.println("end " + tag1 + tag2); }
>    ;
>
> tagbody
>    : (characters)? (tag (characters)?)*
>    ;
>
> characters
>    : text:CHARACTERS { System.out.println("characters[" + text + "]"); }
>    ;
>
> class MyLexer extends Lexer;
>
> options {
> 	k=2;
> 	charVocabulary='\u0000'..'\uFFFE';
> }
>
> CHARACTERS:
>    (~('<'))+
>    ;
>
> LITERAL:
>    ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-')+
>    ;
>
> QLITERAL:
>    '"'! (ESC | ~('\\'|'"'))* '"'!
>    ;
>
> protected
> ESC:
>    '\\' ('\\'|'t'|'n'|'r'|'"') ;
>
>
> WS : (' '|'\t'|'\r'|'\n') ;
>
> LT : '<' ;
> GT : '>' ;
> EQ : '=' ;
> COLON : ':' ;
> SLASH : '/' ;
>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: PGP.sig
> Type: application/pgp-signature
> Size: 186 bytes
> Desc: This is a digitally signed message part
> Url :
> http://www.antlr.org/pipermail/antlr-interest/attachments/20051115/0955443b/PGP-0001.bin
>
> ------------------------------
>
> Message: 11
> Date: Tue, 15 Nov 2005 19:51:16 +0100
> From: Oliver Zeigermann <oliver.zeigermann at gmail.com>
> Subject: Re: [antlr-interest] xml grammar
> To: Torsten Curdt <tcurdt at vafer.org>
> Cc: antlr-interest at antlr.org
> Message-ID: <9da4f4520511151051p11c591abp at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Torsten!
>
> You will need something like lexer modes which you can simulate using
> semantic predicates. In one mode you can match text and in the other -
> the tag mode - you will have all those special characters. You will
> have to switch to that tag mode upon seeing the LT and switch back
> upon GT.
>
> Oliver
>
> P.S.: There actually is an existing XML grammar in the examples that
> come with ANTLR. It is a lexer only solution, though.
>
> 2005/11/15, Torsten Curdt <tcurdt at vafer.org>:
>> I have to cope with a pre-XML-standard so I cannot use one
>> of popular parsers. I am surprised I cannot find an antlr
>> XML grammar on the net.
>>
>> I gave it a try and I've run into some problems with the
>> lexer as the lexer cannot distinguish between the literal
>> that identifies a tag name or the characters inside a tag.
>>
>>  From the context of the token it should be obvious what it
>> is.
>>
>> Here is what I've come up so far. Of course PIs, comments
>> and DOCTYPE declarations are still missing...
>>
>> Anyone some insights on how to solve that?
>>
>> --------------
>>
>> header {
>>      package my.package;
>>      }
>>
>> class MyParser extends Parser;
>>
>> options {
>>         k=2;
>> }
>>
>> parse
>>    :
>>    ( tag )+
>>    ;
>>
>> tag
>>    : LT tag1:LITERAL (COLON tag2:LITERAL)? (WS)*
>>      (attr1:LITERAL (COLON attr2:LITERAL)? EQ value1:QLITERAL (WS)*
>> {  } )*
>>      { System.out.println("started " + tag1 + tag2); }
>>      ((SLASH GT) | (GT tagbody LT SLASH LITERAL (COLON LITERAL)? GT))
>>      { System.out.println("end " + tag1 + tag2); }
>>    ;
>>
>> tagbody
>>    : (characters)? (tag (characters)?)*
>>    ;
>>
>> characters
>>    : text:CHARACTERS { System.out.println("characters[" + text + "]"); }
>>    ;
>>
>> class MyLexer extends Lexer;
>>
>> options {
>>         k=2;
>>         charVocabulary='\u0000'..'\uFFFE';
>> }
>>
>> CHARACTERS:
>>    (~('<'))+
>>    ;
>>
>> LITERAL:
>>    ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-')+
>>    ;
>>
>> QLITERAL:
>>    '"'! (ESC | ~('\\'|'"'))* '"'!
>>    ;
>>
>> protected
>> ESC:
>>    '\\' ('\\'|'t'|'n'|'r'|'"') ;
>>
>>
>> WS : (' '|'\t'|'\r'|'\n') ;
>>
>> LT : '<' ;
>> GT : '>' ;
>> EQ : '=' ;
>> COLON : ':' ;
>> SLASH : '/' ;
>>
>>
>>
>>
>
>
> ------------------------------
>
> _______________________________________________
> antlr-interest mailing list
> antlr-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/antlr-interest
>
>
> End of antlr-interest Digest, Vol 12, Issue 23
> **********************************************
>



More information about the antlr-interest mailing list