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

Re: C++ code generation

Expand Messages
  • Zhen Liu
    I just throw in 2 more cents from my experience. I have been extensively using STL on various projects. I love it. It greately increased my productivity in
    Message 1 of 12 , Jun 15, 1999
    • 0 Attachment
      I just throw in 2 more cents from my experience.

      I have been extensively using STL on various projects.
      I love it. It greately increased my productivity in
      terms of short time, good extensibility, and low bug rate.
      Besides, I do not believe anyone needs to find a perfect
      STL before using it. The only issue (not a important issue)
      is whether it is ANSI C++ compliant or not.

      As for g++, there are two version threads, g++ 2.8.1
      (most recent one), and egcs g++ 1.1.2 (most recent one).
      So, check out which gcc you are using. I guess most of
      you are using (if you are) gcc 2.7.X.

      g++ 2.7.X and 2.8.1 includes HP STL, whereas egcs g++
      SGI STL (and enhanced with ANSI C++ 1997? I guess).
      It seems Antkison is using g++ 2.7.X and HP STL.

      I am still using PCCTS 1.33 (together with STL in my
      code). It worked for me on both g++ compilers.

      As for PCCTS 2.6 (which I never touched), I recommend
      you use egcs g++. And I believe you can hack through
      on g++ 2.8.1/2.7.X.

      Cheers,

      Zhen


      > X-Sender: mtr@...
      > Date: Tue, 15 Jun 1999 12:33:28 -0400
      > To: antlr-interest@onelist.com
      > From: "Michael T. Richter" <mtr@...>
      > Mailing-List: list antlr-interest@onelist.com; contact
      antlr-interest-owner@onelist.com
      > Delivered-To: mailing list antlr-interest@onelist.com
      > List-Unsubscribe: <mailto:antlr-interest-unsubscribe@...>
      > Mime-Version: 1.0
      > Subject: Re: [antlr-interest] C++ code generation
      >
      > From: "Michael T. Richter" <mtr@...>
      >
      > At 12:16 PM 6/15/99 , you wrote:
      > >Coming back to your query, if I am not mistaken, it is possible to use STL
      > with
      > >g++. I do not know how, but I believe you can.
      >
      > Unless this is a VERY recent development, I think you are mistaken. We
      > just recently had to go through the whole "which compilers support STL"
      > exercise at my place of employment and g++ didn't make it onto the list.
      > (To be fair most compilers didn't support STL completely.)
      > --
      > Michael T. Richter <mtr@...> http://www.igs.net/~mtr/
      > PGP Key: http://www.igs.net/~mtr/pgp-key.html
      > PGP Fingerprint: 40D1 33E0 F70B 6BB5 8353 4669 B4CC DD09 04ED 4FE8
      >
      > ------------------------------------------------------------------------
      > With more than 20 million e-mails exchanged daily...
      > http://www.onelist.com
      > ...ONElist is home to the liveliest discussions on the Internet!
    • Per Bernhardsson
      This discussion is heading a bit off topic, bu I can t let this go unanswered. Gcc 2.7.2 does not support STL very well to say the least, I think it s got
      Message 2 of 12 , Jun 15, 1999
      • 0 Attachment
        This discussion is heading a bit off topic, bu I can't let this go
        unanswered. Gcc 2.7.2 does not support STL very well to say the least,
        I think it's got something to do with a bad template
        implementation. If you instead use egcs 1.1 (I think) or later you
        will be able to compile the generated code without problem. There is a
        gcc 2.8 now which I haven't tried so it might work also.

        Other interesting things about egcs it is a modified gcc so that the
        improvements there will be merged into the main gcc branch and create
        (I things go as planned) gcc 2.9 which will then naturally support the
        full STL implementation.

        / Per
      • Henk Jansen
        Antlr 2.6.0 + egcs-19990524 (snapshot) works FINE for me on Linux, RedHat 5.2. (don t know about earlier versions). -- -Ir. Henk Jansen -
        Message 3 of 12 , Jun 16, 1999
        • 0 Attachment
          Antlr 2.6.0 + egcs-19990524 (snapshot) works FINE for me on
          Linux, RedHat 5.2. (don't know about earlier versions).

          --
          -Ir. Henk Jansen - hjansen@... - phone/fax +31(0)15-278-7295/7209-
          - Dept. of Mathematics and Computer Science - Delft University of Technology -
          ----------- http://ta.twi.tudelft.nl/users/hjansen/H.Jansen.html -------------
        • vivek bhaskar
          Hi, I am working on antlr 2.7.1, to generate C++ code. Actually i had started with antlr 2.7.2, but even after repeated try, i was not able to produce static
          Message 4 of 12 , Apr 28, 2003
          • 0 Attachment
            Hi,
            I am working on antlr 2.7.1, to generate C++ code. Actually i had started
            with antlr 2.7.2, but even after repeated try, i was not able to produce
            static lib for c++ given in antlr/lib/cpp, due to one consistent error in
            code and thus shifted to 2.7.1.

            Here, i tried to generate C++ code, in which i call a function say,
            void myfunction(string &mystruing)
            and use a global variable
            string myvar;

            so i put both in header as
            header{
            #include ...

            void myfunction(string &mystruing);
            string myvar;
            }

            But to my utter surprise it start throwing error as it doesnt' recognise
            "string" as a type, and so had to shift to char*. Although i am able to get
            correct result yet(i hope i will), but now it successfully compiled.

            so, my question is this:
            Is any body working on antlr, taking care of C++ features, as the current
            versions, support antlr only for namesake?


            Lastly:
            when in java parser i did,

            left: r=right { use r}..it worked.

            But when i tried same in parser, to generate C++, it gave error and
            thus i had only choice, to use tree parser. Can anbody illustrate this
            problem?

            vivek














            _________________________________________________________________
            Hot picks. Free downloads. http://www.msn.co.in/musicnew/musicshop Visit
            music shop
          • Ric Klaren
            Hi, ... 2.7.1 is buggy YMMV. Check the archives for fixes for MSVC that were posted after 2.7.2 release. When I get some time I plan to release or a devel
            Message 5 of 12 , Apr 28, 2003
            • 0 Attachment
              Hi,

              On Mon, Apr 28, 2003 at 04:04:03PM +0530, vivek bhaskar wrote:
              > I am working on antlr 2.7.1, to generate C++ code. Actually i had started
              > with antlr 2.7.2, but even after repeated try, i was not able to produce
              > static lib for c++ given in antlr/lib/cpp, due to one consistent error in
              > code and thus shifted to 2.7.1.

              2.7.1 is buggy YMMV. Check the archives for fixes for MSVC that were posted
              after 2.7.2 release. When I get some time I plan to release or a devel
              snapshot or see if we can get a official release with fixes for MSVC and
              other stuff that popped up after 2.7.2 release.

              > Here, i tried to generate C++ code, in which i call a function say,
              > void myfunction(string &mystruing)
              > and use a global variable
              > string myvar;
              >
              > so i put both in header as
              > header{
              > #include ...
              >
              > void myfunction(string &mystruing);
              > string myvar;
              > }

              The header section is not really the place to place a declaration like
              that. Check out the docs:

              http://www.antlr.org/doc/cpp-runtime.html#_template

              Also could be that you omitted a std:: prefix somewhere, depending on your
              compiler and it's settings. Also try looking at the generated code and see
              if things are in the places where you expect them.

              > so, my question is this:
              > Is any body working on antlr, taking care of C++ features, as the current
              > versions, support antlr only for namesake?

              I take care of C++ stuff mostly. Yet off late I'm having trouble finding
              time. Development platform is the Gnu C++ compiler. Compilers I test on
              before release are various gcc's and one or two Sun CC version, I don't
              have access to more. MSVC I usually receive post mortem fixes for (after
              release)

              > Lastly:
              > when in java parser i did,
              >
              > left: r=right { use r}..it worked.
              >
              > But when i tried same in parser, to generate C++, it gave error and
              > thus i had only choice, to use tree parser. Can anbody illustrate this
              > problem?

              If you illustrate what your problem exactly is I might be able to help. It
              is really no help to post the working java code and not the non working C++
              code. Rest assured that I use this stuff daily and it works.

              Cheers,

              Ric
              --
              -----+++++*****************************************************+++++++++-------
              ---- Ric Klaren ----- j.klaren@... ----- +31 53 4893722 ----
              -----+++++*****************************************************+++++++++-------
              "I think we better split up."
              "Good idea. We can do more damage that way."
              --- Ghostbusters
            Your message has been successfully submitted and would be delivered to recipients shortly.