[antlr-interest] Getting names of lexer/parser rules from a Runtime

Udo Weik WeikEngOff at aol.com
Sun Oct 23 13:35:33 PDT 2011


Hello again Jim,

> Again, why do you want the NAMES of the rules? But there is no automated
> way to program this.

I want to use the C-runtime only as a wrapper, the actual code will be
executed in an event driven scripting engine. Therefore I must know
which rule triggered the event.

Many thanks and greetings
Udo


>> -----Original Message-----
>> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>> bounces at antlr.org] On Behalf Of Udo Weik
>> Sent: Friday, October 21, 2011 4:45 AM
>> To: antlr-interest at antlr.org
>> Subject: [antlr-interest] Getting names of lexer/parser rules from a
>> Runtime
>>
>> Hello,
>>
>> I already asked Jim that question concerning the C-Runtime.
>> His answer:
>>   >  No - you have to code that. But they are rarely useful. If you want
>> them>  as indicators for error refinement, then implement a global
>> scope and add>  it to each rule, in the rule set a scope member
>> variable to a predefined>  value for each rule, then access the scope
>> stack in the error reporting>  method.
>>
>> So my question is - what is the simplest way to get these names? I'm
>> working with complex grammars, so at least I want to automate adding
>> necessary (action) code snippets (e. g. via Regex search and replace).
>> Any other/better ideas?
>>
>>
>> Many thanks and greetings
>> Udo
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
>> email-address
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list