[antlr-interest] antlr-interest Digest, Vol 41, Issue 98

gaochunguang gaochunguang at 163.com
Sun Apr 27 01:14:17 PDT 2008


understand. thank you.
----- Original Message ----- 
From: <antlr-interest-request at antlr.org>
To: <antlr-interest at antlr.org>
Sent: Sunday, April 27, 2008 3:00 AM
Subject: antlr-interest Digest, Vol 41, Issue 98


> 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. Python UnBufferedTreeNodeStream (Gobaan_Raveendran at amis.com)
>   2. passing an argument to a lexer (siemsen at ucar.edu)
>   3. Re: passing an argument to a lexer (Johannes Luber)
>   4. Re: passing an argument to a lexer (Gavin Lambert)
>   5. how to pronounce "antlr"? (gaochunguang)
>   6. Re: how to pronounce "antlr"? (Dmitry Gusev)
>   7. Re: how to pronounce "antlr"? (Randall R Schulz)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 25 Apr 2008 16:37:54 -0400
> From: Gobaan_Raveendran at amis.com
> Subject: [antlr-interest] Python UnBufferedTreeNodeStream
> To: antlr-interest at antlr.org
> Message-ID:
> <OFB643F9BA.00AEEF07-ON85257436.007105E2-85257436.007155A4 at amis.com>
> Content-Type: text/plain; charset=US-ASCII
> 
> Hello Factorial,
> 
> I was looking through tree.py in the antlr source and I realized
> UnBufferedTreeNodeStream was missing. Is there any reason for this? I am
> wondering as I will likely need to implement it in order to bring down the
> memory footprint of my program.
> 
> Thanks
> - Gobi
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Sat, 26 Apr 2008 01:23:00 -0600
> From: siemsen at ucar.edu
> Subject: [antlr-interest] passing an argument to a lexer
> To: antlr-interest at antlr.org
> Message-ID: <4840B7B7-5FDB-49EC-8B09-BE9A82B8777B at ucar.edu>
> Content-Type: text/plain; charset="us-ascii"
> 
> I have a working translator that implements include files using the  
> scheme described in the ANTLR Wiki page titled  "How do I implement  
> include files?" at http://www.antlr.org/wiki/pages/viewpage.action?pageId=557057
> 
> It works, but only if the include files are located in the current  
> directory.  To run the translator, I have to "cd" to the right  
> directory first.  Not good.
> 
> I want the translator to look for include files relative to the  
> current input file.  It's easy to get the base path of the current  
> input file, but I don't know how to get the path into the lexer.  The  
> relevant fragment of my "rig" looks like this
> 
> <etc.>
> File inputFile = new File(inputFileName);
> String inputSubDirectory = inputFile.getParent();
> 
> // Open an input file stream from the given file name
> CharStream input = new ANTLRFileStream(inputFileName);
> // Create a lexer that feeds from the input file stream
> TranslateCIMLexer lexer = new TranslateCIMLexer(input);
> // Create a stream of tokens fed by the lexer
> CommonTokenStream tokens = new CommonTokenStream(lexer);
> <etc.>
> 
> How can I pass inputSubDirectory into TranslateCIMLexer so that it's  
> available in lexer rule actions?
> 
> I hoped that calling input.getSourceName() from the relevant lexer  
> rule action might give the full path to the file, but the compiler  
> gave me
> 
> /Users/siemsen/TranslateCIM/target/generated-sources/antlr/ 
> TranslateCIMLexer.java:[1449,82] cannot find symbol
> symbol  : method getSourceName()
> location: interface org.antlr.runtime.CharStream
> 
> -- Pete
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080426/f8b51285/attachment-0001.html 
> 
> ------------------------------
> 
> Message: 3
> Date: Sat, 26 Apr 2008 12:26:51 +0200
> From: Johannes Luber <jaluber at gmx.de>
> Subject: Re: [antlr-interest] passing an argument to a lexer
> To: siemsen at ucar.edu
> Cc: antlr-interest at antlr.org
> Message-ID: <4813036B.10008 at gmx.de>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> siemsen at ucar.edu schrieb:
>> I want the translator to look for include files relative to the current 
>> input file.  It's easy to get the base path of the current input file, 
>> but I don't know how to get the path into the lexer.  The relevant 
>> fragment of my "rig" looks like this
> 
> It is pretty simple. Add in the lexer grammar
> 
> @members {
> 
> private String path;
> 
> public void setPath(String path) {
> this.path = path;
> }
> }
> 
> Then you have to change your driver to use this setter and you lexer to 
> use the path member field.
> 
> Johannes
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Sat, 26 Apr 2008 22:33:04 +1200
> From: Gavin Lambert <antlr at mirality.co.nz>
> Subject: Re: [antlr-interest] passing an argument to a lexer
> To: siemsen at ucar.edu,antlr-interest at antlr.org
> Message-ID: <20080426103316.A107D11EAB2 at www.antlr.org>
> Content-Type: text/plain; charset="us-ascii"; format=flowed
> 
> At 19:23 26/04/2008, siemsen at ucar.edu wrote:
>>I hoped that calling input.getSourceName() from the relevant 
>>lexer rule action might give the full path to the file, but the 
>>compiler gave me
>>
>>/Users/siemsen/TranslateCIM/target/generated-sources/antlr/TranslateCIMLexer.java:[1449,82] 
>>cannot find symbol
>>symbol  : method getSourceName()
>>location: interface org.antlr.runtime.CharStream
> 
> getSourceName isn't defined on CharStream, it's on 
> ANTLRFileStream.  You can get to it with a cast, if you're 
> absolutely certain you're only going to be giving file streams to 
> the lexer:
> 
> ... ((ANTLRFileStream)input).getSourceName() ...
> 
> (Actually, it appears to be *defined* on ANTLRStringStream, but I 
> can't see how this would give it a useful value.)
> 
> Another (possibly better) option is to use a @members (or 
> @lexer::members) section to create an additional field/property in 
> your lexer class where you can store the base directory 
> name.  This is potentially more flexible, since you can extend it 
> later to search multiple folders (for example).  It also doesn't 
> limit you to using file streams, which is useful when unit-testing 
> the grammar.
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Sat, 26 Apr 2008 21:26:37 +0800
> From: "gaochunguang" <gaochunguang at 163.com>
> Subject: [antlr-interest] how to pronounce "antlr"?
> To: <antlr-interest at antlr.org>
> Message-ID: <001801c8a7a1$27e6ceb0$6501a8c0 at alien>
> Content-Type: text/plain; charset="gb2312"
> 
> I have used antlr for one year. but how to pronounce "antlr"? :)
> 
> thank.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080426/c7978ad9/attachment-0001.html 
> 
> ------------------------------
> 
> Message: 6
> Date: Sat, 26 Apr 2008 17:50:26 +0400
> From: "Dmitry Gusev" <dmitry.gusev at gmail.com>
> Subject: Re: [antlr-interest] how to pronounce "antlr"?
> To: gaochunguang <gaochunguang at 163.com>
> Cc: antlr-interest at antlr.org
> Message-ID:
> <37a147f40804260650w3abc3ae4r2e020b6311419d1a at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> [antlr] ? :)
> 
> On Sat, Apr 26, 2008 at 5:26 PM, gaochunguang <gaochunguang at 163.com> wrote:
> 
>>  I have used antlr for one year. but how to pronounce "antlr"? :)
>>
>> thank.
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080426/67a71b96/attachment-0001.html 
> 
> ------------------------------
> 
> Message: 7
> Date: Sat, 26 Apr 2008 07:04:15 -0700
> From: Randall R Schulz <rschulz at sonic.net>
> Subject: Re: [antlr-interest] how to pronounce "antlr"?
> To: antlr-interest at antlr.org
> Message-ID: <200804260704.15302.rschulz at sonic.net>
> Content-Type: text/plain;  charset="utf-8"
> 
> On Saturday 26 April 2008 06:26, gaochunguang wrote:
>> I have used antlr for one year. but how to pronounce "antlr"? :)
> 
> As if there were an 'e' between the 'l' and the 'r': "antler."
> 
> Or any way you want, since few of us ever run into each other to be 
> heard pronouncing it wrong...
> 
> I have a colleague who prounounces UML "ooml" and XOR "zor."
> 
> Then there's URL, which goes both way, letters or "earl." Or GIF, which 
> can be either "giff" or "jiff."
> 
> And just yesterday I heard a professor talking on the BBC pronouncing 
> Linux with a hard 'i'. She said it several times, so wasn't a slip. I 
> though we left that one behind years ago.
> 
> 
>> thank.
> 
> 
> RRS
> 
> 
> ------------------------------
> 
> _______________________________________________
> antlr-interest mailing list
> antlr-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/antlr-interest
> 
> 
> End of antlr-interest Digest, Vol 41, Issue 98
> **********************************************


More information about the antlr-interest mailing list