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

2.7.2a2 C# codegen...

Expand Messages
  • micheal_jor
    Few questions to those interested: 1. Should the classes that make up the runtime be .NET-tified or left as is with Java conventions? I m referrring to the
    Message 1 of 3 , Apr 4 2:33 PM
    View Source
    • 0 Attachment
      Few questions to those interested:

      1. Should the classes that make up the runtime be .NET-tified or left
      as is with Java conventions? I'm referrring to the casing, use of
      Properties as opposed to get/set methods etc

      2. Is there a way to check if _saveIndex will actually be used before
      declaring it?. I delayed the declaration until first use but then the
      more serious problem in [3] raised it's ugly head so, I regressed to
      default behaviour.

      3. Is there a way to ensure that _saveIndex is not redefined within a
      nested scope/block. This is an error in C# unlike Java. A prefix or
      suffix to make each declaration unique within all enclosing blocks
      would be fine or, just reusing a single method-wide declaration if
      there would be no interactions between it's various uses.

      4. I've only converted about five examples due to time constaints -
      java, calc, filter/filterWithRule, ASTSupport, columns and exprAST I
      think. Anyone up to converting the others?

      5. I would like to allow the users to be able to specify a C#
      namespace to be used by default for all the
      lexers/parsers/treeparsers defined in a *.g file. I would also like a
      per-lexer/parser/treeparser namespace declaration option that
      overrides the default (if any) on a per-class basis:

      options
      {
      language = "CSharp";
      namespace = "appel.tiger";
      }

      class TigerParser extends Parser;
      options { namespace = "appel.tiger.parser"; }

      Finally, how do I get this into ANTLR?. Just mail it to Terrence is
      it?

      Micheal
    • Smith, Eric V.
      1. I d leave them as is, not .Net-ify them. It makes debugging easier. 3. I ran in to this problem as well. I just created a global label generator. Not
      Message 2 of 3 , Apr 4 2:58 PM
      View Source
      • 0 Attachment
        1. I'd leave them as is, not .Net-ify them. It makes debugging easier.

        3. I ran in to this problem as well. I just created a global label
        generator. Not the cleanest thing, but it works. I can't believe that
        MS made this design decision. The last time I was out there I discussed
        this with a member of the C# team. He says they're aware of the
        generated code issue, but they felt it would prevent many mistakes. I
        disagree, but we're stuck with it.

        4. I'm willing to convert some samples. I've got all of the samples I
        converted from the last time I did this, I suspect many of them will
        work with your code. But I'm going out of town tomorrow, I'll be back
        next week.

        5. I don't have an opinion one way or the other on this one. Do
        whatever you feel is best.

        Thanks for the work. I look forward to trying it out.

        Eric.


        > -----Original Message-----
        > From: micheal_jor [mailto:open.zone@...]
        > Sent: Thursday, April 04, 2002 5:34 PM
        > To: antlr-interest@yahoogroups.com
        > Subject: [antlr-interest] 2.7.2a2 C# codegen...
        >
        >
        > Few questions to those interested:
        >
        > 1. Should the classes that make up the runtime be .NET-tified or left
        > as is with Java conventions? I'm referrring to the casing, use of
        > Properties as opposed to get/set methods etc
        >
        > 2. Is there a way to check if _saveIndex will actually be used before
        > declaring it?. I delayed the declaration until first use but then the
        > more serious problem in [3] raised it's ugly head so, I regressed to
        > default behaviour.
        >
        > 3. Is there a way to ensure that _saveIndex is not redefined within a
        > nested scope/block. This is an error in C# unlike Java. A prefix or
        > suffix to make each declaration unique within all enclosing blocks
        > would be fine or, just reusing a single method-wide declaration if
        > there would be no interactions between it's various uses.
        >
        > 4. I've only converted about five examples due to time
        > constaints - java, calc, filter/filterWithRule, ASTSupport,
        > columns and exprAST I
        > think. Anyone up to converting the others?
        >
        > 5. I would like to allow the users to be able to specify a C#
        > namespace to be used by default for all the
        > lexers/parsers/treeparsers defined in a *.g file. I would also like a
        > per-lexer/parser/treeparser namespace declaration option that
        > overrides the default (if any) on a per-class basis:
        >
        > options
        > {
        > language = "CSharp";
        > namespace = "appel.tiger";
        > }
        >
        > class TigerParser extends Parser;
        > options { namespace = "appel.tiger.parser"; }
        >
        > Finally, how do I get this into ANTLR?. Just mail it to Terrence is
        > it?
        >
        > Micheal
        >
        >
        >
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >
        >
      • Ric Klaren
        ... With C++ I m more and more leaning to C++-ifying them. But this is mostly because C++ has some more powerfull things to do some stuff (with templates).
        Message 3 of 3 , Apr 5 1:00 AM
        View Source
        • 0 Attachment
          On Thu, Apr 04, 2002 at 10:33:32PM -0000, micheal_jor wrote:
          > 1. Should the classes that make up the runtime be .NET-tified or left
          > as is with Java conventions? I'm referrring to the casing, use of
          > Properties as opposed to get/set methods etc

          With C++ I'm more and more leaning to C++-ifying them. But this is mostly
          because C++ has some more powerfull things to do some stuff (with
          templates). Which in the end will be necessary for Unicode support (I
          think). If the java way is enough like the .Net way then I would leave it
          as java'ish as possible saves time in porting over new stuff/fixes from the
          java mode.

          > 2. Is there a way to check if _saveIndex will actually be used before
          > declaring it?. I delayed the declaration until first use but then the
          > more serious problem in [3] raised it's ugly head so, I regressed to
          > default behaviour.


          > 3. Is there a way to ensure that _saveIndex is not redefined within a
          > nested scope/block. This is an error in C# unlike Java. A prefix or
          > suffix to make each declaration unique within all enclosing blocks
          > would be fine or, just reusing a single method-wide declaration if
          > there would be no interactions between it's various uses.

          I think I kludged around something similar in the C++ codegen. Think I did
          it with AST declarations. My fix is d*mn ugly though. We need a different
          codegenerator setup.

          My problem was that after delaying declarations, I sometimes hid a previous
          declaration which yielded 'real usefull'(tm) trees. Look for genASTdecl and
          needASTdecl func/vars in CppCodegenerator.java.

          _saveIndex maybe tougher though to tackle. You may need to scan ahead in
          grammar elements (eeiew)

          > 5. I would like to allow the users to be able to specify a C#
          > namespace to be used by default for all the
          > lexers/parsers/treeparsers defined in a *.g file. I would also like a
          > per-lexer/parser/treeparser namespace declaration option that
          > overrides the default (if any) on a per-class basis:

          There's some namespace stuff in the C++ mode. Dunno if it's usable for your
          problem. Maybe it's possible to share some code between C++/C# mode.

          > Finally, how do I get this into ANTLR?. Just mail it to Terrence is
          > it?

          Good choice ;)

          Cheers,

          Ric
          --
          -----+++++*****************************************************+++++++++-------
          ---- Ric Klaren ----- klaren@... ----- +31 53 4893722 ----
          -----+++++*****************************************************+++++++++-------
          'And this 'rebooting' business? Give it a good kicking, do you?' 'Oh, no,
          of course, we ... that is ... well, yes, in fact,' said Ponder. 'Adrian
          goes round the back and ... er ... prods it with his foot. But in a
          technical way,' he added. --- From: Hogfather by Terry Pratchett.
        Your message has been successfully submitted and would be delivered to recipients shortly.