[antlr-interest] How to tell the lexer to stop?(C runtime target )

chain one chainone at gmail.com
Thu Jan 15 00:58:03 PST 2009


Well, thanks for Gavin's suggestion, as what you said, then I should first
take some time to under the source code of the Lexer part.Actually I have
tried to read the source code of the C runtime target, and I have to say, it
is not a easy stuff.

Does anybody have the experience of meeting  the same problem with me? If it
is yes, could you tell me how to solve it? I would very appreciate your
help.


On Thu, Jan 15, 2009 at 4:45 PM, Gavin Lambert <antlr at mirality.co.nz> wrote:

> At 21:35 15/01/2009, chain one wrote:
>
>> I want to only parse the beginning of a file. And I don't want the
>> recognizer to beak the whole file into huge number of tokens which will make
>> the memory consuming very high.
>> So after the lexer having recognized one specified TOKEN such as ";", I
>> want to tell the lexer to stop, and pass the tokens to the parser.
>> Is it possible in C runtime target? If it is, could you tell me how?
>>
>
> I don't think you can do it directly in the grammar, but you should be able
> to override some methods in the lexer or the stream to do that.  (And yes,
> you *can* override methods in the C target; it's just slightly trickier than
> in Java or C#.)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090115/5ea42649/attachment.html 


More information about the antlr-interest mailing list