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

Matthias Gutheil matthias.gutheil at informatik.uni-mannheim.de
Sun Oct 22 04:11:27 PDT 2006


Many C files one by one...

-- Matthias

Loring Craymer schrieb:
> What are you trying to do, then?  For a single file,
> building a custom tool is usually overkill.  If you
> just want to do analysis of a single file, take a look
> at Columbus/CAN from
> <http://www.frontendart.com/>--it's a pretty nice tool
> and there is an evaluation period during which you can
> license it for free.
>
> --Loring
>
> --- Matthias Gutheil
> <matthias.gutheil at informatik.uni-mannheim.de> wrote:
>
>   
>> 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 too
>> 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 
>>>   
>>>       
>>     
>
>
> __________________________________________________
> 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