Loading ...
Sorry, an error occurred while loading the content.

Possible bug in generated C# code

Expand Messages
  • iooab23
    I was attempting to port StringTemplate 2.0 to C# and I am running into some problems with the C# code generated by ANTLR 2.7.4. Issue #1: The _saveIndex
    Message 1 of 7 , Dec 14, 2004
    • 0 Attachment
      I was attempting to port StringTemplate 2.0 to C# and I am running
      into some problems with the C# code generated by ANTLR 2.7.4.

      Issue #1: The _saveIndex variable created in the lexers is being
      declared multiple times in a single function. The C# compiler
      complains that the variable already exists.

      Issue #2: The constructor for the ActionParser is being generated
      incorrectly. ANTLR generates:

      public ActionParser(TokenStream lexer, StringTemplate self) {
      this(lexer, 2);
      this.self = self;
      }

      should be:

      public ActionParser(TokenStream lexer, StringTemplate self) : this
      (lexer, 2) {
      this.self = self;
      }

      Is anyone familiar with these issues? Are there fixes available for
      them?
    • Terence Parr
      ... I should get you 2.1, which I hope to release in a few weeks. Should I send you the latest tarball? Actually, I m moving the antlr.org depot to a faster
      Message 2 of 7 , Dec 14, 2004
      • 0 Attachment
        On Dec 14, 2004, at 12:24 PM, iooab23 wrote:
        > I was attempting to port StringTemplate 2.0 to C# and I am running
        > into some problems with the C# code generated by ANTLR 2.7.4.

        I should get you 2.1, which I hope to release in a few weeks. Should I
        send you the latest tarball? Actually, I'm moving the antlr.org depot
        to a faster box and that is a good time to put stringtemplate into that
        repository so you could access it.

        Ter
        --
        CS Professor & Grad Director, University of San Francisco
        Creator, ANTLR Parser Generator, http://www.antlr.org
        Cofounder, http://www.jguru.com
        Cofounder, http://www.knowspam.net enjoy email again!
      • micheal_jor
        ... ... Hi Steve, Thanks for the report. Can you send a grammar that triggers/demonstrates these issues please?. It would help if we hope to resolve
        Message 3 of 7 , Dec 14, 2004
        • 0 Attachment
          --- In antlr-interest@yahoogroups.com, "iooab23" <sarandos.steve@p...>
          wrote:
          >
          >
          > I was attempting to port StringTemplate 2.0 to C# and I am running
          > into some problems with the C# code generated by ANTLR 2.7.4.
          >
          > Issue #1: The _saveIndex variable created in the lexers is being
          > declared multiple times in a single function. The C# compiler
          > complains that the variable already exists.
          >
          > Issue #2: The constructor for the ActionParser is being generated
          > incorrectly. ANTLR generates:

          <SNIP>

          > Is anyone familiar with these issues? Are there fixes available for
          > them?

          Hi Steve,

          Thanks for the report. Can you send a grammar that
          triggers/demonstrates these issues please?. It would help if we hope
          to resolve this issue before a 2.7.5 release.

          We're working on StringTemplate but waiting for the 2.1 code from Ter.

          Cheers,

          Micheal
          ANTLR/C#
        • Terence Parr
          ... Heh, great! Ok, I ll definitely move ST to the antlr.org depot as soon as my new box is up; perhaps you folks can coordinate. Hmm...I wonder how to make
          Message 4 of 7 , Dec 14, 2004
          • 0 Attachment
            On Dec 14, 2004, at 4:00 PM, micheal_jor wrote:
            > We're working on StringTemplate but waiting for the 2.1 code from Ter.

            Heh, great! Ok, I'll definitely move ST to the antlr.org depot as soon
            as my new box is up; perhaps you folks can coordinate.

            Hmm...I wonder how to make the C# port easy to do in the future. Well,
            one thing for sure: the language is rapidly approaching "completeness"
            and, hence, stability.

            Ter
            --
            CS Professor & Grad Director, University of San Francisco
            Creator, ANTLR Parser Generator, http://www.antlr.org
            Cofounder, http://www.jguru.com
            Cofounder, http://www.knowspam.net enjoy email again!
          • micheal_jor
            ... wrote: OK, some update from Kunle on the second issue reported. ... This isn t a bug (or indeed an issue) with C# code generation. The code above was
            Message 5 of 7 , Dec 14, 2004
            • 0 Attachment
              --- In antlr-interest@yahoogroups.com, "iooab23" <sarandos.steve@p...>
              wrote:

              OK, some update from Kunle on the second issue reported.

              > Issue #2: The constructor for the ActionParser is being generated
              > incorrectly. ANTLR generates:
              >
              > public ActionParser(TokenStream lexer, StringTemplate self) {
              > this(lexer, 2);
              > this.self = self;
              > }
              >
              > should be:
              >
              > public ActionParser(TokenStream lexer, StringTemplate self) : this
              > (lexer, 2) {
              > this.self = self;
              > }

              This isn't a bug (or indeed an issue) with C# code generation. The
              code above was manually embedded in StringTemplate's action.g grammar
              file. Embedded code blocks are simply copied to the output with no
              further processing.

              Cheers,

              Micheal
              ANTLR/C#
            • iooab23
              ... grammar ... Ah, your right. I didn t notice that. I m still learning my way around ANTLR and reading the grammar files. I should ve checked for that.
              Message 6 of 7 , Dec 15, 2004
              • 0 Attachment
                > This isn't a bug (or indeed an issue) with C# code generation. The
                > code above was manually embedded in StringTemplate's action.g
                grammar
                > file. Embedded code blocks are simply copied to the output with no
                > further processing.
                >
                > Cheers,
                >
                > Micheal
                > ANTLR/C#

                Ah, your right. I didn't notice that. I'm still learning my way
                around ANTLR and reading the grammar files. I should've checked for
                that. Thanks.
              • Sarandos Steve
                Attached is the ported code including the grammars that have the _saveIndex problem. I fixed the code by hand so you ll need to regenerate to see the
                Message 7 of 7 , Dec 15, 2004
                • 0 Attachment
                  Attached is the ported code including the grammars that have the
                  "_saveIndex" problem. I fixed the code by hand so you'll need to
                  regenerate to see the problem. The lexers produced by group.g,
                  angle.bracket.template.g, template.g and action.g all show the problem.

                  -----Original Message-----
                  From: micheal_jor [mailto:open.zone@...]
                  Sent: Tuesday, December 14, 2004 7:01 PM
                  To: antlr-interest@yahoogroups.com
                  Subject: [antlr-interest] Re: Possible bug in generated C# code




                  --- In antlr-interest@yahoogroups.com, "iooab23" <sarandos.steve@p...>
                  wrote:
                  >
                  >
                  > I was attempting to port StringTemplate 2.0 to C# and I am running
                  > into some problems with the C# code generated by ANTLR 2.7.4.
                  >
                  > Issue #1: The _saveIndex variable created in the lexers is being
                  > declared multiple times in a single function. The C# compiler
                  > complains that the variable already exists.
                  >
                  > Issue #2: The constructor for the ActionParser is being generated
                  > incorrectly. ANTLR generates:

                  <SNIP>

                  > Is anyone familiar with these issues? Are there fixes available for
                  > them?

                  Hi Steve,

                  Thanks for the report. Can you send a grammar that triggers/demonstrates
                  these issues please?. It would help if we hope to resolve this issue
                  before a 2.7.5 release.

                  We're working on StringTemplate but waiting for the 2.1 code from Ter.

                  Cheers,

                  Micheal
                  ANTLR/C#







                  Yahoo! Groups Links
                Your message has been successfully submitted and would be delivered to recipients shortly.