Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

What came first: A compiler or a code?

Discussion in 'General Discussion' started by elmar1028, Jan 29, 2016.

  1. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    I wonder...
     
    kittik and Deleted User like this.
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,301
    Code. Punchcards, and directly typing in values.
     
    Kiwasi, Socrates and GarBenjamin like this.
  3. gameDevi

    gameDevi

    Joined:
    Oct 14, 2015
    Posts:
    155
  4. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    My guess is:

    Code existed first - IF you qualify machine language as 'code'

    The first compiler was written in machine language directly (it had to, as no compilers existed).

    That compiler took assembler and generated machine code.

    The first C compiler was then written in assembler.

    Then a the C compiler was re-written in C and compiled with the C compiler written in assembler.

    Then it's turtles all the way down...
     
    MD_Reptile, GarBenjamin and RockoDyne like this.
  5. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    They used to enter the code directly on the computer and then later even would program the gates permanently that create the program, which which evolved to be a large part of the functionality of modern processors - pre-created ready-to-run libraries.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,521
    Last edited: Jan 29, 2016
  7. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Jamster and Ryiah like this.
  8. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,521
    Good point! I had thought about mentioning those, or even the antikythera long, long before that, but I think Lovelace's program is the first example of proto-modern algorithmic code. I hadn't thought of the loom as a graphics processor, though. Talk about old school graphics! :)
     
    Last edited: Jan 29, 2016
    darkhog likes this.
  9. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    I was thinking that before `programs` there had to be direct setting of binary flags or switches or vacuum tubes or whatever, and only later was there any translation from something else. If you've ever written in assembly language you'll know its as close to the hardware as you can get without writing binary codes directly... which is sometimes possible (self modifying code).
     
  10. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
    Rocks and other miscellaneous items predate those.
     
    Jamster likes this.
  12. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,521
    I'll play devil's advocate here and argue that abacuses, etc., (and rocks ;)) are tools to assist human computers, whereas code in the sense of the original post refers to an instruction set that runs on an automated computer.

    But now that I think about it, humans manually translated high-level algorithms into machine-level instructions long before programs were written to automate the translation. That makes humans the first compilers, so I guess compilers predate code after all.
     
    Deleted User and Ryiah like this.
  13. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    The first C++ compiler was written in C++. Chew on that!
     
  14. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Maths.
     
    Eric-Darkomen likes this.
  15. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    It must've been code because you only have 2 options, which is binary.
     
  16. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Before code you could write logic directly into switches. I still 'write' logic in pneumatics or relays from time to time for my day job.
     
  17. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,301
    IIRC at least some of the first computers operated on base-10.
    Babbage computer was base 10 (wasn't actually built till many years later), and WITCH was also decimal.
     
    Kiwasi likes this.
  18. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    But the question was which came first, code or compiler. Those are more like peripherals to help the human computer.
     
  19. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    First came interpreter of instructions(for lamp computers that was reader of perfocards/punchcards/whatever else you call them). Was that compiler or not? It does transform input data (from punchcards into electronic signal) so it can be called so. But assuming we don't say that our modern processors 'compile' instructions, but 'interpret' instead, I'd say first was interpreter, then code, then compiler. If you say interpreting code from one type of instructions into another is compiling - then hardware compiler first. It all depends on how you define it.
     
  20. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,301
    There was no interpreter. Just instructions.

    Imagine a music box.



    That would be roughly equivalent to the first computers.

    Command directly performs operations. "Interpreter" assumes there is an intermediate form command needs to be translated from one form into another to be executed. In first machine, there's no intermediate form and nothing to translate. Therefore, no interpreter and no compiler.
     
    Kiwasi and Ryiah like this.
  21. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
    Yet neither the Jacquard loom (the punch card loom) nor music boxes are the oldest examples. There is an even older example from 1725. A paper tape loom by Basile Bouchon. I don't doubt there are even older examples of automated systems beyond this (like the automatic flute mentioned in the Book of Ingenious Devices published in 850).

    https://en.wikipedia.org/wiki/Basile_Bouchon

     
  22. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    Actually, music box can be treated as interpreter.
    Music goes this way: compositor(human)->writes music in notes->music box plays music->listener(human) receives it. So music box a way of interpreting a note into something listener(human) can understand!

    Nice interpreting, nice code. I wasn't sure for several minutes where exactly they are here :) In this case I think interpreter was built before code as code was created later in order to match interpreter's results... But not sure.

    P.S. Oldest interpreter is human. Oldest code is language he speaks/writes. So what came first: a human or a word?
     
  23. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,301
    That's wordplay and semantic argument, though.

    To understand music you need to be a musician. Most people enjoy it without understanding, good portion of them don't even have a basic musical hearing ability. Music invokes feelings, instead of transmitting information.

    If you gonna turn it that way, then "langauge" as in "means of transmitting information" predates humans, code, writing, compilers and interpreters.

    Before humans, speech animals used smell, sound and posture to transmit signals.

    For example: Cat Communication
     
  24. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Everyone knows the biological computer came first. We're strictly speaking of constructed machines, not biological ones. At least that's what I'm talking about.
     
    Ryiah likes this.
  25. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
    There are some who speak of computational hardware that exists on another plane. Some claim it is a great singular computer while others speak of a multitude. We'd need a Gate spell to learn the truth of the matter completely.
     
  26. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    Same as question in topic. It doesn't have proper context and can be read as "What came first: people who compiled documents or encoded documents?".
    Aren't feeling information too? Or maybe invoking feeling is understanding music? Everything depends on how to look at it. After all, meaning of information is created by sentient beings, not by information itself.
    That I can agree on. But cats appeared after first smells. Was that code? I doubt as it was not
    (As google said to me) before cats appeared. So what is code?
    Offtop: phrase fits avatars.

    "A long time ago in a galaxy far, far away...." Are you sure there was never another computer there? How did it look? So... Was it before code or after?
     
    Last edited: Jan 30, 2016
  27. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    me like beer.

    welcome to earth.
     
  28. I_Am_DreReid

    I_Am_DreReid

    Joined:
    Dec 13, 2015
    Posts:
    361
    The chicken.....it definetly came first.
     
  29. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    Would you count an abacus as a computer?

    & @JaanDoe , it was only the chicken if it was male.
     
  30. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,706
    Dinosaurs laid eggs.
     
  31. I_Am_DreReid

    I_Am_DreReid

    Joined:
    Dec 13, 2015
    Posts:
    361
    It was a namekian chicken
     
  32. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Actually it's a bit like this.

    Once there were two birds and neither was a chicken (because they did not exist yet). These two birds had sex and their offspring was the first chicken.

    I see that the chicken egg clearly came before the chicken as no creature turned from not being a chicken to being a chicken during their life (genetics don't typically work like that) :)
     
  33. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,301
    Nope.

    If we gonna delve further into pointless semantic argument, then
    Proposition "All information provokes emotional response in every receiver of such information" is false.
    However
    "Some information may provoke emotional response from certain receivers in specific circumstances" is true.

    Well, by going in that direction you're gonna hit solipsism and religious arguments.

    Basically, you cannot prove that world exists and is not a very convincing hallucination.

    Also, it is impossible to prove existence or non-existence of something you cannot perceive. You can't prove that a computer that predates humans exists, say, somewhere outside of the range of obsevrvable universe. You also can't prove it doesn't exist. So considering that scenario won't lead you anywhere.
     
  34. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
    Creationists would likely state the chicken came first. Evolutionists would state the egg did. At least that's how I view that silly argument (at least when I'm not trying to poke fun at it).
     
    Last edited: Jan 31, 2016
    larku likes this.
  35. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Schrödinger's cat says that while inside the egg, the chicken is both a chicken and not a chicken.

    I take it back. Schrödinger's cat says "chicken. Yum." Schrödinger would say that. Not his cat.
     
    Ryiah likes this.
  36. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Can entropy be reversed? Can I ever return to a state of not having wasted time reading this thread?
     
    Ryiah likes this.
  37. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Well... If you had posted the first question as a headline then we could have answered simply using Betteridge's law..

    But you didn't.. did you! Stop making things hard.
     
  38. dogmachris

    dogmachris

    Joined:
    Sep 15, 2014
    Posts:
    1,373
    code of course. the most basic code being an analogue framework of 0s and 1s for controlling electrical circuits doesn't require any compiling.
     
  39. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Before there is any chance of any conclusion to this questions we need to first agree on what the definition 'code' and 'compiler' are. Within the nomenclature of computer science 'code' is likely to have a different meaning to 'code' in other disciplines (genetics, mathematics, security, etc). It's evident from most replies that there is not yet a consensus amongst ourselves :)

    I'm assuming our definitions of compiler are more aligned though - yet that's just an assumption.
     
    Kiwasi and Ryiah like this.
  40. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    You're wrong... See my questions about interpreter above.
     
  41. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Ha, which is why is used the word assumption twice :)

    I see a mention of 'no need for a compiler' - but I'm not sure how that invalidates a consensus on its definition (not that I'm claiming there is one :) )
     
  42. Teravisor

    Teravisor

    Joined:
    Dec 29, 2014
    Posts:
    654
    I meant that:
    So was that a compiler? Where is that defined? (My quote itself had quite a lot of valid counterarguments, so I'm not bringing it for discussion again, just for definition purposes)
     
  43. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
    You're missing the most important parts of the definition. A compiler, according to Wikipedia, is a computer program that transforms source code from a programming language into another computer language. You might be able to stretch the definition by having the compiler implemented in hardware but it has to actually transform the source code.

    A hardware device that reads data into the computer is merely transferring the contents of that data medium directly into the computer. It doesn't actually transform the data from one language into another.
     
    Kiwasi likes this.
  44. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,301
    Merriam Webster has the same definition:

    However, as with any semantic arguments, it is possible to waste eternity arguing about definition of "computer", "program", "translates", "higher-level", "language" and "symbolic".

    That's why I don't like semantic arguments. Lots of wasted time, very little information learned, pure sophistry.
     
    larku and Kiwasi like this.
  45. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    This. In modern usage a compiler converts human readable code into machine readable code.

    A compiler is not the process of taking machine readable code and turning it into machine actions. That would be the job of the computer.

    So by those definitions code (machine readable instructions) predates the compiler (a machine to convert human readable language into machine readable instructions).

    However it's important to note that the two items have always been closely coupled. Here is an early image of a device used to create punch cards. Not exactly a compiler by modern standards. But punch cards are not exactly code either.

    https://en.m.wikipedia.org/wiki/File:PunchingJacquardCardPoland.jpg
     
  46. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    The analogue of a punch card today (IMO) would be neither part of code nor compiler. Its analogue is the keyboard (ie, the mechanism to enter the data). Especially given that most (well at least a lot of) punchcards were 'punched' by hand (by most university students anyway) and then fed into the machine (worlds worst keyboard with latency time measured in days :) )
     
    Ryiah likes this.
  47. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,301
    The analogue of a keyboard is a keypunch machine.
    Not a punchcard.

    https://en.wikipedia.org/wiki/Keypunch
    http://www.pcmag.com/encyclopedia/term/45805/keypunch-machine
     
    Kiwasi and Ryiah like this.
  48. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
    UNIVACs had card readers that could hit 600 (or 900 in some cases) cards per minute. Still fairly slow as input devices go though. Not to mention if something went wrong and it "ate" your cards in the process.
     
  49. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Thinking about this I'm going to change my opinion - the punch card is a data storage device (no interpretation or conversion going on there), the mechanism to punch the card is the keyboard analogue (as you say).

    The punch card acts only as a store of data. It is without function.

    (note, this is certainly not something I'd want to argue about, take my discussion in the lightest possible manner :) )
     
    Kiwasi and Ryiah like this.
  50. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,495
    This. A compiler simply turns one form of "code" into another.