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

Re: [hackers-il] [colloq@cs.Technion.AC.IL: Shimon Schocken on Tuesday 05/06/2001]

Expand Messages
  • Oleg Goldshmidt
    ... IIRC, there is also p2c. Maybe that will work with your favourite gcc version. -- Oleg Goldshmidt | ogoldshmidt@NOSPAM.computer.org I d rather write
    Message 1 of 14 , Apr 10, 2001
    • 0 Attachment
      mulix <mulix@...> writes:

      > pascal commpiler and an SML interpreter for linux. i tried both GPC and
      > free pascal (fpc).

      IIRC, there is also p2c. Maybe that will work with your favourite
      gcc version.

      --
      Oleg Goldshmidt | ogoldshmidt@...
      "I'd rather write programs to write programs than write programs."
    • Nadav Har'El
      ... Don t worry, I think the actual course is given in the IDC, not the Technion, so you won t get a chance to take it anyway :) The lecture I was pointing out
      Message 2 of 14 , Apr 10, 2001
      • 0 Attachment
        On Tue, Apr 10, 2001, Shlomi Fish wrote about "Re: [hackers-il] [colloq@...: Shimon Schocken on Tuesday 05/06/2001]":
        >
        > Hmmm. This course sounds like "Logic Design and Intro to Computers" of the
        > EE faculty (http://tiger.technion.ac.il/~imenache/Logic/) on steroids.
        >
        > I would not attend this Hack-Vack-Jack course, because since I took Logic
        > Design (and like I said earlier it was my favourite course so far), I
        > don't know whether it will renew a lot to me.

        Don't worry, I think the actual course is given in the IDC, not the Technion,
        so you won't get a chance to take it anyway :) The lecture I was pointing
        out to is only a lecture _about_ the course. A meta-lecture.

        > Besides, I probably will need a zillion CS faculty pre-requisites which I
        > don't have.

        I thought their idea was to let you play around with stuff before you know
        all the details of how they work (although when I hear the lecture I'll
        probably know more about what their idea is). When I first started playing
        around with Yacc I was 12 and knew nothing about compiler theory (heck, I
        was in elementary school!) - but I managed to take an existing compiler and
        add new syntax to it, and later this made me interested about how compilers
        *really* work, until a few years later I finally read the dragon book.
        Perhaps their course was also meant to motivate new students - I don't
        know, I'll have to hear their lecture I guess.

        > Since the course mentions compilers I thought I'll share a story with you.
        > A friend of mine has an HP48 calculator, which can be programmed in
        > Assembler. When he installed Linux, he decided to write a Pascal compiler
        > for it - from scratch, without even using Lex and Yacc. He told me that
        > there was already a C compiler for it, but I left it at that.

        If he decided not to use Yacc (or a similar tool), I hope that he at least
        learned some compiler theory... Reinventing compiler theory on your own is
        not, to put it mildly, a trivial undertaking ;)

        > And this is without all those Something -> C translators. Do you know of
        > any others?

        Many years ago, when C was beginning to dominate the world, most new
        compilers where written as Something-to-C compilers. The idea was that
        why should you compiler some language to Assembly Language of a specific
        machine, when you already have a "portable assembly language", namely C.
        I've seen successful propriatary compilers like this, and also Pascal to C,
        Fortran to C, Awk to C, and similar compilers. I'm not sure why, but it
        appears as though gcc killed that trend. The stand-alone Fortan-to-C
        compiler was ditched in favor for a Fortran front-end withing gcc. There
        are downsides to this close integrate (bloatware?), such as you can't
        compile Fortran on a machine that has a C compiler, but not gcc (e.g., I
        had a C compiler on a Commodore-64!). So what are the real benefits in this
        monolithic approach? Is it the better optimization possibilities? Wouldn't
        this problem be solved if C optimizers are improved?

        --
        Nadav Har'El | Tuesday, Apr 10 2001, 17 Nisan 5761
        nyh@... |-----------------------------------------
        Phone: +972-53-245868, ICQ 13349191 |Isn't Disney World a people trap
        http://nadav.harel.org.il |operated by a mouse?
      • Nadav Har'El
        ... I don t know the official rules, but my inner morals tells me that it is perfectly fine to publish homework *you* did, assuming that your solution is a
        Message 3 of 14 , Apr 10, 2001
        • 0 Attachment
          On Tue, Apr 10, 2001, mulix wrote about "Re: [hackers-il] [colloq@...: Shimon Schocken on Tuesday 05/06/2001]":
          > (a tangent: i asked a professor whether i could publish my homework on the
          > web [after the due date, of course] and he could not supply a definite
          > answer. can someone enlighten me on the relevant academic rules?)

          I don't know the official rules, but my inner morals tells me that it is
          perfectly fine to publish homework *you* did, assuming that your solution
          is a much more substantial work than the question itself. What is NOT fine
          is to look at such solutions instead of trying to do the work yourself.

          In my opinion the same should be true also for tests: you should be allowed
          to publish previous tests and suggested solutions. As far as I saw, this was
          the norm in the Technion (the student union even gave people small gifts
          if you gave them copies of tests) but strangely it seems to be frowned upon
          in HaifaU...

          It is obvious why professors would not want previous excercises and tests
          to be published - it will force them to make up new questions every once
          in a while. But every now and then these professors need to be reminded that
          they are paid for this work, and that the raison d'etre of BA studies is
          to teach the students well, not to make life easy for the professor...

          > a rant on pascal: how can a language have none of
          > case sensitivity
          > initialization of const arrays
          > no return from functions or procedures (!)

          I think that Brian Kernighan agrees with you :) He wrote (in 1981, that's
          20 years ago!) a technical report about why Pascal sucks, titled "Why Pascal
          is Not My Favorite Programming Language". See

          http://cm.bell-labs.com/cm/cs/cstr/100.ps.gz

          You can also see his homepage, at http://cm.bell-labs.com/who/bwk/.


          --
          Nadav Har'El | Tuesday, Apr 10 2001, 17 Nisan 5761
          nyh@... |-----------------------------------------
          Phone: +972-53-245868, ICQ 13349191 |A Life? Cool! Where can I download one
          http://nadav.harel.org.il |of those from?
        • mulix
          ... it appears to me that the major loss in such an intermediate compiler is in the area of optimisations. consider the no alias keyword of C99, which says
          Message 4 of 14 , Apr 10, 2001
          • 0 Attachment
            On Tue, 10 Apr 2001, Nadav Har'El wrote:

            > Many years ago, when C was beginning to dominate the world, most new
            > compilers where written as Something-to-C compilers. The idea was that
            > why should you compiler some language to Assembly Language of a specific
            > machine, when you already have a "portable assembly language", namely C.
            > I've seen successful propriatary compilers like this, and also Pascal to C,
            > Fortran to C, Awk to C, and similar compilers. I'm not sure why, but it
            > appears as though gcc killed that trend. The stand-alone Fortan-to-C
            > compiler was ditched in favor for a Fortran front-end withing gcc. There
            > are downsides to this close integrate (bloatware?), such as you can't
            > compile Fortran on a machine that has a C compiler, but not gcc (e.g., I
            > had a C compiler on a Commodore-64!). So what are the real benefits in this
            > monolithic approach? Is it the better optimization possibilities? Wouldn't
            > this problem be solved if C optimizers are improved?

            it appears to me that the major loss in such an "intermediate" compiler is
            in the area of optimisations. consider the "no alias" keyword of C99,
            which says a pointer is not aliased by any other pointer, leading to many
            possible optimisations which are too risky otherwise. how would you
            translate this to "old c", without losing this important piece of
            programmer supplied knowledge in the translation? also, perhaphs
            translating to c is much harder than translating to an intermediate
            internal representatio, which is the way gcc front ends work.
            --
            mulix
            http://www.advogato.com/person/mulix

            linux/reboot.h: #define LINUX_REBOOT_MAGIC1 0xfee1dead
          • mulix
            ... there is one class (Digital Systems) i ve taken so far, where no tests are published since the questions come for a closed pool of questions. in all other
            Message 5 of 14 , Apr 10, 2001
            • 0 Attachment
              On Tue, 10 Apr 2001, Nadav Har'El wrote:

              > In my opinion the same should be true also for tests: you should be allowed
              > to publish previous tests and suggested solutions. As far as I saw, this was
              > the norm in the Technion (the student union even gave people small gifts
              > if you gave them copies of tests) but strangely it seems to be frowned upon
              > in HaifaU...
              >
              > It is obvious why professors would not want previous excercises and tests
              > to be published - it will force them to make up new questions every once
              > in a while. But every now and then these professors need to be reminded that
              > they are paid for this work, and that the raison d'etre of BA studies is
              > to teach the students well, not to make life easy for the professor...

              there is one class (Digital Systems) i've taken so far, where no tests are
              published since the questions come for a closed pool of questions. in all
              other classes, the tests are always published, nearly always with official
              solutions.

              > I think that Brian Kernighan agrees with you :) He wrote (in 1981, that's
              > 20 years ago!) a technical report about why Pascal sucks, titled "Why Pascal
              > is Not My Favorite Programming Language". See
              >
              > http://cm.bell-labs.com/cm/cs/cstr/100.ps.gz
              >
              > You can also see his homepage, at http://cm.bell-labs.com/who/bwk/.

              i've read it in the past, but i'll read it again. oh, and thanks for the
              pointer to stroustroup's april's fools paper. it was hilarious!
              --
              mulix
              http://www.advogato.com/person/mulix

              linux/reboot.h: #define LINUX_REBOOT_MAGIC1 0xfee1dead
            • Moshe Zadka
              ... You forgot Chill -- I ll be ex-DPL soon anyway so I m |LUKE: Is Perl better than Python? looking for someplace else to grab power. |YODA:
              Message 6 of 14 , Apr 10, 2001
              • 0 Attachment
                On Tue, 10 Apr 2001, Shlomi Fish <shlomif@...> wrote:

                > In any case, how many language front-ends there are to gcc anyways. Here
                > are the ones I'm aware of:
                >
                > 1. ANSI C (gcc)
                > 2. C++ (g++)
                > 3. Objective C (comes with the gcc distribution)
                > 4. Pascal (gpc and perhaps also Free Pascal)
                > 5. Java and Java byte code (gcj)
                > 6. Ada (GNATS - it's written in Ada, so you need to bootstrap it)
                > 7. Fortran 77 (g77) - available on GNU sites.
                > 8. Haskell - Glasgow Haskell Compiler or ghc. It is written in Haskell,
                > and requires itself to be compiled.

                You forgot Chill

                --
                "I'll be ex-DPL soon anyway so I'm |LUKE: Is Perl better than Python?
                looking for someplace else to grab power."|YODA: No...no... no. Quicker,
                -- Wichert Akkerman (on debian-private)| easier, more seductive.
                For public key, finger moshez@... |http://www.{python,debian,gnu}.org
              • Oleg Goldshmidt
                ... I don t know about it. Can anyone confirm? A bit of personal reminiscences: For a few years I worked for a company that was writing tons of Fortran code,
                Message 7 of 14 , Apr 10, 2001
                • 0 Attachment
                  "Nadav Har'El" <nyh@...> writes:

                  > The stand-alone Fortan-to-C compiler was ditched in favor for a
                  > Fortran front-end withing gcc.

                  I don't know about it. Can anyone confirm?

                  A bit of personal reminiscences:

                  For a few years I worked for a company that was writing tons of
                  Fortran code, with the main development compiler being f2c/gcc (in the
                  fort77 incarnation). Worked like a charm (better than commercial
                  compilers we had on our target platforms), last time I recall a
                  problem was years ago, and the fix was really fast.

                  For probably something like a couple of years, when g77 reached some
                  sort of maturity, I used both f2c and g77. Both worked fine, g77 was a
                  bit stricter about standards as I recall. there were some differences
                  regarding debugging information, overall I think that f2c/gcc
                  combination worked better with gdb (as I recall this stuff was very
                  well explained in some pretty obvious place in the info pages, for the
                  inquisitive). Maybe I was simply more used to it though.

                  One benefit of f2c/gcc combination is that you can look at the C code,
                  which may come handy if you mix C and Fortran. One must be cautious,
                  of course, since f2c is not guaranteed to do the same thing as other
                  Fortran compilers, but it's useful and instructive nonetheless.

                  > So what are the real benefits in this monolithic approach?

                  [Irrelevant for GCC]: Financial? You can charge for separate
                  compilers... ;-)

                  > Is it the better optimization possibilities? Wouldn't this problem
                  > be solved if C optimizers are improved?

                  Maybe the fact that different languages follow different models, and
                  it is not always optimal (in many senses) to twist a language to
                  produce something fairly contorted in C, something that a C compiler
                  may have trouble dealing with or optimizing or...

                  --
                  Oleg Goldshmidt | ogoldshmidt@...
                  "I'd rather write programs to write programs than write programs."
                • Oleg Goldshmidt
                  ... I forgot to mention that I do see advantages in translating everything into a portable assembler . Or into lisp (to have both a compiler and an
                  Message 8 of 14 , Apr 10, 2001
                  • 0 Attachment
                    Oleg Goldshmidt <ogoldshmidt@...> writes:

                    > Maybe the fact that different languages follow different models, and
                    > it is not always optimal (in many senses) to twist a language to
                    > produce something fairly contorted in C, something that a C compiler
                    > may have trouble dealing with or optimizing or...

                    I forgot to mention that I do see advantages in translating everything
                    into a "portable assembler". Or into lisp (to have both a compiler
                    and an interpreter) -- as Chen was right to mention.

                    --
                    Oleg Goldshmidt | ogoldshmidt@...
                    "I'd rather write programs to write programs than write programs."
                  • Shlomi Fish
                    ... I didn t forget, I just didn t knew a Chill front-end (or the Chill language for that matter) existed in the first place. But now we have 9 front-ends and
                    Message 9 of 14 , Apr 10, 2001
                    • 0 Attachment
                      On Tue, 10 Apr 2001, Moshe Zadka wrote:

                      > On Tue, 10 Apr 2001, Shlomi Fish <shlomif@...> wrote:
                      >
                      > > In any case, how many language front-ends there are to gcc anyways. Here
                      > > are the ones I'm aware of:
                      > >
                      > > 1. ANSI C (gcc)
                      > > 2. C++ (g++)
                      > > 3. Objective C (comes with the gcc distribution)
                      > > 4. Pascal (gpc and perhaps also Free Pascal)
                      > > 5. Java and Java byte code (gcj)
                      > > 6. Ada (GNATS - it's written in Ada, so you need to bootstrap it)
                      > > 7. Fortran 77 (g77) - available on GNU sites.
                      > > 8. Haskell - Glasgow Haskell Compiler or ghc. It is written in Haskell,
                      > > and requires itself to be compiled.
                      >
                      > You forgot Chill
                      >

                      I didn't forget, I just didn't knew a Chill front-end (or the Chill
                      language for that matter) existed in the first place. But now we have 9
                      front-ends and going strong.

                      Regards,

                      Shlomi Fish

                      ----------------------------------------------------------------------
                      Shlomi Fish shlomif@...
                      Home Page: http://t2.technion.ac.il/~shlomif/
                      Home E-mail: shlomif@...

                      A more experienced programmer does not make less bugs. He just realizes
                      what went wrong more quickly.
                    • Nadav Har'El
                      ... But that was my original point, if you view C as a portable assembler . After all, C is very low level. Surely, if C has some constructs that cannot be
                      Message 10 of 14 , Apr 10, 2001
                      • 0 Attachment
                        On Tue, Apr 10, 2001, Oleg Goldshmidt wrote about "Re: [hackers-il] [colloq@...: Shimon Schocken on Tuesday 05/06/2001]":
                        > I forgot to mention that I do see advantages in translating everything
                        > into a "portable assembler". Or into lisp (to have both a compiler
                        > and an interpreter) -- as Chen was right to mention.

                        But that was my original point, if you view C as a "portable assembler".
                        After all, C is very low level. Surely, if C has some constructs that
                        cannot be optimized without knowledge of the architecture of the specific
                        machine, then you'll have the same problem with any portable assembler
                        you devise. If you do a loop in assembly language, and can't assume that
                        a called function (or another thread) doesn't change the loop pointer, then
                        you face the same optimizing problem you have when compiling C...

                        I'm sure that there is some optimization pentalty in compiling to C, but
                        I would be suprised if that penalty is substantial when using a good C
                        compiler. Of course, this wouldn't be true if another language was chosen
                        instead of C - the assumption is that it is a very low-level language quite
                        close to the machine language.


                        --
                        Nadav Har'El | Tuesday, Apr 10 2001, 17 Nisan 5761
                        nyh@... |-----------------------------------------
                        Phone: +972-53-245868, ICQ 13349191 |Can Microsoft make a product that
                        http://nadav.harel.org.il |doesn't suck? Yes, a vacuum cleaner!
                      • Oleg Goldshmidt
                        ... Precisely. I was concerned that my previous posting would be regarded as a disagreement, so I wrote the appendage. -- Oleg Goldshmidt |
                        Message 11 of 14 , Apr 10, 2001
                        • 0 Attachment
                          "Nadav Har'El" <nyh@...> writes:

                          > On Tue, Apr 10, 2001, Oleg Goldshmidt wrote about "Re: [hackers-il] [colloq@...: Shimon Schocken on Tuesday 05/06/2001]":

                          > > I forgot to mention that I do see advantages in translating everything
                          > > into a "portable assembler". Or into lisp (to have both a compiler
                          > > and an interpreter) -- as Chen was right to mention.
                          >
                          > But that was my original point,

                          Precisely. I was concerned that my previous posting would be regarded
                          as a disagreement, so I wrote the appendage.

                          --
                          Oleg Goldshmidt | ogoldshmidt@...
                          "I'd rather write programs to write programs than write programs."
                        Your message has been successfully submitted and would be delivered to recipients shortly.