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

Jim Idle jimi at temporal-wave.com
Sun Oct 23 14:16:38 PDT 2011


Why would you need the names of the rules to do this?

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Udo Weik
> Sent: Sunday, October 23, 2011 1:36 PM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Getting names of lexer/parser rules from
> a Runtime
>
> 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
>
> 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