Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Chicken or the egg?

Chicken or the egg?

Scheduled Pinned Locked Moved The Lounge
questionc++
24 Posts 18 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    keegan
    wrote on last edited by
    #1

    Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

    T Z R R M 12 Replies Last reply
    0
    • K keegan

      Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

      T Offline
      T Offline
      Tim Smith
      wrote on last edited by
      #2

      C++ started off as a lot of macros. Tim Smith I'm going to patent thought. I have yet to see any prior art.

      1 Reply Last reply
      0
      • K keegan

        Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

        Z Offline
        Z Offline
        Zachery
        wrote on last edited by
        #3

        You have a lang where the rules of that lang are agreed upon so that a complier can be written. The compiler came soon afer the lang. It's basically similar to when the "rules" (I use that term rather loosely), of the English lang were agreed upon, and soon after the grammar dictionary was written. I hope that helps a bit. If not, I dunno.

        ..........Zack.......... Developer Extraordinaire

        "I will stand on my side of the fence, reguardless of the circumstances or the consequence." - Monoxide "Wait! My brain is working!" - Ed "Everyone! I know something!!" - Freakazoid GCS\P\SS d- s-:- a-- C++$ U--- P--- L- E- W++ N o K-? w+++ O++ !M-- V PS+ PE Y+ PGP t+ 5+ X+ R++ tv++ b++ DI++ D+++ G+>G++++ e* h- r++ y+

        1 Reply Last reply
        0
        • K keegan

          Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

          R Offline
          R Offline
          Richard Stringer
          wrote on last edited by
          #4

          I once used a compiler from Bell Labs that took C++ syntax and converted it to C to run thru cc. SO my bet would be that the language constructs came before the compiler. I would be interested to know how namy of the modern compilers have, at their heart , a C compiler. Compilers are a real bear to write properly and I bet there is a lot of code carried over. Richard "The man that hath not music in himself and is not moved with concord of sweet sounds is fit for treasons, stratagems and spoils; Let no man trust him." Shakespeare

          M 1 Reply Last reply
          0
          • K keegan

            Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

            R Offline
            R Offline
            Roger Wright
            wrote on last edited by
            #5

            keegan wrote: How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? It's a progressive thing... You start with an assembler built using machine code, then implement your language's commands in assembly to make a rudimentary compiler. Then you use your language to build more complex and functional compilers for languages you design. Still, the language has to be designed first before you can decide what your compiler needs to do. "Some people are like Slinkies... not really good for anything,
            but you still can't help but smile when you see one
            tumble down the stairs."

            M 1 Reply Last reply
            0
            • K keegan

              Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              I imagine the very first compiler was written in assembler. Once you have one build of the compiler (let's call the language Bob++), you can compile Bob++ source code with that Bob++ compiler. That means you can start writing the Bob++ compiler in Bob++. :cool: --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber CP SearchBar v2.0.2 released

              1 Reply Last reply
              0
              • K keegan

                Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

                L Offline
                L Offline
                leppie
                wrote on last edited by
                #7

                :) leppie::AllocCPArticle("Zee blog");
                Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

                1 Reply Last reply
                0
                • K keegan

                  Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

                  N Offline
                  N Offline
                  Navin
                  wrote on last edited by
                  #8

                  I think it depends on the language. I believe that Pascal was bootstrapped: 1. A minimal Pascal compiler was written in assembly. 2. The next Pascal compiler was written with the compiler in step 1. 3. The next Pascal compiler was written with the compiler in step 2. ... and so forth, until a compiler that could handle the entire language was built. But I guess that means the language itself had to be defined before the compiler could be built for it. If your nose runs and your feet smell, then you're built upside down.

                  1 Reply Last reply
                  0
                  • K keegan

                    Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

                    P Offline
                    P Offline
                    pseudonym67
                    wrote on last edited by
                    #9

                    I think the java compiler was originally written in C and then rewritten in java. Apparently it was running too fast and showing the programs up :-D pseudonym67 Neural Dot Net Articles 1-11 Start Here Fuzzy Dot Net Articles 1-4 Start Here "Do you hide in Happy Hour?" Marillion Clutching At Straws

                    C J 2 Replies Last reply
                    0
                    • P pseudonym67

                      I think the java compiler was originally written in C and then rewritten in java. Apparently it was running too fast and showing the programs up :-D pseudonym67 Neural Dot Net Articles 1-11 Start Here Fuzzy Dot Net Articles 1-4 Start Here "Do you hide in Happy Hour?" Marillion Clutching At Straws

                      C Offline
                      C Offline
                      Chris Meech
                      wrote on last edited by
                      #10

                      pseudonym67 wrote: Apparently it was running too fast and showing the programs up ROFLMAO. Chris Meech If you spin a Chinese person around, do they become dis-oriented? Why do people in this time period worry so much about time traveler's destroying their worldline when they have no problem doing it themselves every day? John Titor.

                      1 Reply Last reply
                      0
                      • R Richard Stringer

                        I once used a compiler from Bell Labs that took C++ syntax and converted it to C to run thru cc. SO my bet would be that the language constructs came before the compiler. I would be interested to know how namy of the modern compilers have, at their heart , a C compiler. Compilers are a real bear to write properly and I bet there is a lot of code carried over. Richard "The man that hath not music in himself and is not moved with concord of sweet sounds is fit for treasons, stratagems and spoils; Let no man trust him." Shakespeare

                        M Offline
                        M Offline
                        Mike Dimmick
                        wrote on last edited by
                        #11

                        Visual C++ has two front ends, c1.dll and c1xx.dll, responsible for parsing the source code into a common abstract representation (as in, common to both C and C++ code). The back end, which translates the abstract representation into actual executable code, is implemented in c2.dll - I think this module actually includes two translators now, one to x86 machine code and another to MSIL; the representation between the two stages of the compiler is richer than MSIL, and is a development of the one from VC 6.0. When you specify link-time code generation with VC 7.x, the second stage isn't run by cl.exe - the OBJ files contain the abstract representation. link.exe uses c2.dll to generate the code at link time. In theory, you could get VC to generate machine code for a different platform by replacing c2.dll. However, the different platforms so far have had slight differences in intrinsics and large ones in __asm or asm blocks, so a new front end has also had to be produced. eMbedded Visual C++ 3.0 comes with five variants of cl.exe and its attendant DLLs - cl.exe (x86), clarm.exe (ARM), shcl.exe (Hitachi SH3 and SH4), clmips.exe (MIPS R4000 series) and clppc.exe (PowerPC).

                        J 1 Reply Last reply
                        0
                        • K keegan

                          Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

                          T Offline
                          T Offline
                          Tom Welch
                          wrote on last edited by
                          #12

                          If you are serious about finding out look for Dr. Grace Hopper. She died not too long ago. She worked for the Navy on some of the first computers. Here is a good start: Dr. Grace Hopper[^] A very interesting woman. I like her name. I tend to forget names easily but her name is a classic. Her accomplishments include: Creating the first compiler (in fact others thought this feat to be impossible) Creating the first computer language Coining the term BUG

                          T C J 3 Replies Last reply
                          0
                          • R Roger Wright

                            keegan wrote: How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? It's a progressive thing... You start with an assembler built using machine code, then implement your language's commands in assembly to make a rudimentary compiler. Then you use your language to build more complex and functional compilers for languages you design. Still, the language has to be designed first before you can decide what your compiler needs to do. "Some people are like Slinkies... not really good for anything,
                            but you still can't help but smile when you see one
                            tumble down the stairs."

                            M Offline
                            M Offline
                            Mike Dimmick
                            wrote on last edited by
                            #13

                            These days, we'd use C rather than assembler. Indeed, many compilers are written to generate C, at least at first; the GNAT (Gnu NYU Ada Translator) compiler is an adapted GCC which translates Ada into C, then compiles the resulting C code. To port to a new platform, you create a cross-compiler: a compiler which runs on one processor, but generates code for another. Once you have your cross-compiler, you can compile your compiler for the new platform, creating a native compiler. IIRC, the IA-64 and AMD64 versions of Microsoft's cl.exe are cross-compilers: they are themselves x86 executables.

                            1 Reply Last reply
                            0
                            • T Tom Welch

                              If you are serious about finding out look for Dr. Grace Hopper. She died not too long ago. She worked for the Navy on some of the first computers. Here is a good start: Dr. Grace Hopper[^] A very interesting woman. I like her name. I tend to forget names easily but her name is a classic. Her accomplishments include: Creating the first compiler (in fact others thought this feat to be impossible) Creating the first computer language Coining the term BUG

                              T Offline
                              T Offline
                              Tim Smith
                              wrote on last edited by
                              #14

                              hehehe he said rear admiral. Tim Smith I'm going to patent thought. I have yet to see any prior art.

                              1 Reply Last reply
                              0
                              • K keegan

                                Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

                                M Offline
                                M Offline
                                Marc Clifton
                                wrote on last edited by
                                #15

                                keegan wrote: Which came first, the language, or the compiler? Neither. First, people "programmed" by moving wires around to hardcode simple algorithms. Then, von Neumann had the brilliant idea around 1958 that hardware should be fixed but flexible, supporting "programs" that were a collection of subroutines (the idea of re-use is born!). But the programs were still written in machine codes very closely tied to the hardware. Assemblers were a step toward symbolic representation. Languages, like Cobol and Fortran were written to unify diverse and constantly changing machine languages and specialized in business and scientific processing. Thus the concept of the compiler was born, I believe. However, the first language that had a formal syntax (one that could be specified by a lexical parser) came a bit later (dang, I can't remember it's name right now!) and is the precursor for languages like C. As to your confusion, languages like Fortran were written first in assembly code. Marc Latest AAL Article My blog Join my forum!

                                1 Reply Last reply
                                0
                                • K keegan

                                  Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;

                                  G Offline
                                  G Offline
                                  Gary Wheeler
                                  wrote on last edited by
                                  #16

                                  The language definition must come first. The purpose of the compiler is to translate text which conforms to the language syntax into machine code which can be executed. Without knowing what the language syntax is, the compiler can not be written. A compiler can be written in the language it's compiling. It just can't be the first compiler for that language, since there is no tool at that point to turn the source code (for the compiler, in this case) into a running application. It's very rare these days to have to 'bootstrap' a compiler these days on native hardware. It's just too easy to develop the compiler on some other machine or under an existing environment, run it there, and generate code for the target environment.


                                  Software Zen: delete this;

                                  1 Reply Last reply
                                  0
                                  • T Tom Welch

                                    If you are serious about finding out look for Dr. Grace Hopper. She died not too long ago. She worked for the Navy on some of the first computers. Here is a good start: Dr. Grace Hopper[^] A very interesting woman. I like her name. I tend to forget names easily but her name is a classic. Her accomplishments include: Creating the first compiler (in fact others thought this feat to be impossible) Creating the first computer language Coining the term BUG

                                    C Offline
                                    C Offline
                                    Colin Angus Mackay
                                    wrote on last edited by
                                    #17

                                    I would have to disagree about Dr. Grace Hopper creating the first computer language. I would have to say it was Charles Babbage who created the first language (Machine language is also a computer language - someone had to design it!) when he designed his Analytical Engine. And the first programmer was Ada Augusta Byron, the Countess of Lovelace and daughter of Lord Byron. She wrote programs for Charles Babbage's Analytical Engine in the 19th Century. However, as funding ran out the engine was never built and the programs never tested. ...And it was the Egg that came first - it was not a chicken that laid it, but the egg hatched in to a chicken through the miracle of genetics and evolution.

                                    T 1 Reply Last reply
                                    0
                                    • M Mike Dimmick

                                      Visual C++ has two front ends, c1.dll and c1xx.dll, responsible for parsing the source code into a common abstract representation (as in, common to both C and C++ code). The back end, which translates the abstract representation into actual executable code, is implemented in c2.dll - I think this module actually includes two translators now, one to x86 machine code and another to MSIL; the representation between the two stages of the compiler is richer than MSIL, and is a development of the one from VC 6.0. When you specify link-time code generation with VC 7.x, the second stage isn't run by cl.exe - the OBJ files contain the abstract representation. link.exe uses c2.dll to generate the code at link time. In theory, you could get VC to generate machine code for a different platform by replacing c2.dll. However, the different platforms so far have had slight differences in intrinsics and large ones in __asm or asm blocks, so a new front end has also had to be produced. eMbedded Visual C++ 3.0 comes with five variants of cl.exe and its attendant DLLs - cl.exe (x86), clarm.exe (ARM), shcl.exe (Hitachi SH3 and SH4), clmips.exe (MIPS R4000 series) and clppc.exe (PowerPC).

                                      J Offline
                                      J Offline
                                      Jorgen Sigvardsson
                                      wrote on last edited by
                                      #18

                                      Sounds pretty much lika any modern cross compiling compiler :) Did you ever read the Dragon Book? It's nice to see that some theories have actually been implemented.. :-D -- You still have your old friend Zoidberg. You all have Zoidberg!

                                      I 1 Reply Last reply
                                      0
                                      • P pseudonym67

                                        I think the java compiler was originally written in C and then rewritten in java. Apparently it was running too fast and showing the programs up :-D pseudonym67 Neural Dot Net Articles 1-11 Start Here Fuzzy Dot Net Articles 1-4 Start Here "Do you hide in Happy Hour?" Marillion Clutching At Straws

                                        J Offline
                                        J Offline
                                        Jorgen Sigvardsson
                                        wrote on last edited by
                                        #19

                                        :-D Ever tried jikes? The IBM java compiler? It's written in C++ and it SCREAMS! :) -- You still have your old friend Zoidberg. You all have Zoidberg!

                                        P 1 Reply Last reply
                                        0
                                        • T Tom Welch

                                          If you are serious about finding out look for Dr. Grace Hopper. She died not too long ago. She worked for the Navy on some of the first computers. Here is a good start: Dr. Grace Hopper[^] A very interesting woman. I like her name. I tend to forget names easily but her name is a classic. Her accomplishments include: Creating the first compiler (in fact others thought this feat to be impossible) Creating the first computer language Coining the term BUG

                                          J Offline
                                          J Offline
                                          Jorgen Sigvardsson
                                          wrote on last edited by
                                          #20

                                          It would be interesting to discuss modern programming languages with her. Too bad she's passed away. :( -- You still have your old friend Zoidberg. You all have Zoidberg!

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups