[antlr-interest] How to look only for one rule?

Matthias Gutheil matthias.gutheil at informatik.uni-mannheim.de
Sat Oct 21 15:06:24 PDT 2006


Yes but the problem is, that C is context sensitive and I only have one 
c-file and not all the included stuff.
I had a try to change the C grammar, but thats a to hard task for me at 
the moment.

-- Matthias
 

Loring Craymer schrieb:
> Hmm.  In cases where you have a complete grammar (and
> for C, the ANTLR 2 C grammar stuff done by Monty and
> others is definitely complete), I usually find it
> better to take that and recognize everything but only
> process what you need.  I would suggest modifying the
> C grammar to build trees that only contain the methods
> of interest and none of the stuff that you want to
> ignore.  That gets you to a solution fast, and also
> leaves room for extending the range of what you are
> interested in later.
>
> --Loring
>
>
> --- Terence Parr <parrt at cs.usfca.edu> wrote:
>
>   
>> Hi.  See the filter example, which does it all in
>> the lexer.  Have a
>>
>> EVERYTHINGELSE : . ;
>>
>> rule at bottom to skip everything but your rules of
>> interest.
>> Ter
>> On Oct 21, 2006, at 4:54 AM, Matthias Gutheil wrote:
>>
>>     
>>> Hello,
>>>
>>> I am writing a fuzzy C grammar and I am only
>>>       
>> interesting in methods  
>>     
>>> with parameters and return values.
>>>
>>> The method definition is not the problem, but I
>>>       
>> want to skip  
>>     
>>> anything else.
>>> For example something like (method | ~method)
>>>       
>> doesn't work, cause  
>>     
>>> so the first token af a real method (return type
>>>       
>> or name) goes in  
>>     
>>> ~method.
>>>
>>> Some tips?
>>>
>>> Matthias
>>>       
>>     
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>   



More information about the antlr-interest mailing list