[antlr-interest] What are channels and what are they used for?
Robin Davies
rerdavies at rogers.com
Tue Jun 5 16:33:47 PDT 2007
Are there ways to attach a parser to a channel other than default?
I'm working on a grammar that has need of a javaoc-like facilities, and a
C#-style preprocessor (i.e. very simple #if's and #defines); and if channels
actually do anything right now, I'm pretty certain I could make use of it.
Currently, I'm pushing token text for ("#' (~LF)* LF ) out to a secondary
parser. But I can't help feeling that there's a better way to do this.
(Absolutely loving ANTLR 3, btw. After all the grim alternatives -- LL(k),
LALR(1) and/or hopelessly license-encumbered -- ANTLR v3 is a marvelous
change. In my opinion, the release of ANTLR v3 is one of the great
landmarks in the recent history of software development. Very exciting!
Congratulations on your release.).
----- Original Message -----
From: "Terence Parr" <parrt at cs.usfca.edu>
To: "ANTR Interest" <antlr-interest at antlr.org>
Sent: Tuesday, June 05, 2007 12:01 PM
Subject: Re: [antlr-interest] What are channels and what are they used for?
> Hi. :) token channels are a way to avoid discarding tokens (still send
> tokens to the parser) w/o having the parser see them. So, you could send
> whitespace on one channel, javadoc on another, and the java tokens on the
> default channel. Then actions can access the hidden channels for
> translation.
>
> Ter
>
> On Jun 5, 2007, at 6:58 AM, Luke A. Guest wrote:
>
>> On Tue, 2007-06-05 at 13:29 +0200, Johannes Luber wrote:
>>> Luke A. Guest wrote:
>>>> 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?
>>>
>>> The channels are supposed to make tokens invisible so one doesn't have
>>> to deal e.g. with whitespace in the parser. It is possible to access
>>> those hidden tokens, but I didn't figure out how to to do that exactly.
>>
>> Is that all it's used for? I would've thought there'd be more to it than
>> that.
>>
>> Thanks,
>> Luke.
>>
>>
>
More information about the antlr-interest
mailing list