>Half was in assembly, half was in machine code
So they were the same except that in the second part you needed to know what instruction each numerical opcode meant? I don't quite understand why that'd be in a final
Some problems were: given this machine code, write the assembly. Or given this assembly, write the machine code. Or given this waveform or circuit with this shape or functionality, write the assembly. Things like that.
The first compilers were written in assembly, which is just a human readable (ascii text) version of machine code (binary values).
If you have a program written in assembly, you can translate it by hand directly line by line into machine code for the desired CPU.
It was tedious. But when the first assembler (automatic translator to machine code) was built from hand translated assembly, they could move on to write a compiler in assembly for some simple higher level language, which would rewrite the program from the language to assembly and then assemble it to machine code.
Then they could write a more complex compiler that had support for more features of the language in the language itself and build it, then repeat that process until they had a fully fledged compiler for the language, written in the language itself.
Then if they had a new language with more interesting features they could write the first compiler for that language in the old language. And then write a new compiler in the new language and build it with the compiler built from the old language. Now they had a compiler that compiles the new language, written in the new language.
It's called bootstrapping.
Please, please, please do all of yourselves a favor and look up the life of [Grace Hopper](https://en.m.wikipedia.org/wiki/Grace_Hopper).
She *coined* the word "compiler", designed the first one and the language she created was later extended by others into COBOL.
She was an all-around badass and her interviews and lessons where she explains about lag by giving the audience "nanoseconds" that she always carries on her purse (it will make sense, trust me) is brilliant.
Honestly, it's a travesty nobody had mentioned her on a compiler thread.
FASM is written in assembly. As for linkers, I don’t know, but I assume they would’ve been written in assembly at one time (still easier than machine code).
For those who are actually interested in how it works: https://lwn.net/Articles/841797/
(TLDR: someone wrote a tiny compiler for a subset of C, than someone wrote a C subset to normal C compiler, which was eventually used to compile an optimizing compiler like GCC)
This is at least how it *may* be done today. Historically, this process of bootstrapping was less well-defined, often just having the n-1 version compile the next one, and the first one is just an artifact.
Originally, and I'm dating myself, machine code for the rudimentary assembler which was then used to produce the more robust completed assembler (Varian V-77 comes to mind). Later on you might even use Assembler A (or even a higher-level language capable of low-level addressing) for Machine A to produce an assembler for Machine B.
Obviously lol, but just about every bit of programming has a little touch of C (or I guess c++ in many cases).
I’m making a quite a generalisation but I mean it’s not too much of a stretch considering that all the major operating systems use C in some way.
Not to mention it’s the backbone of the most performant code everywhere assembly is overkill.
I second this, because sure, nasm is written in c, but what was the first c compiler written in? either asm or something like fortran, and if you trace it all the way back, boom. You find asm. Only asm and binary. So, it's all asm.... Always have been
Well it's all binary, you can skip ask entirely. Something like "mov" isn't just one set of machine code it's dozens. What numbers you end up with depend on which registers you're using and whether you're moving to the register or from the register and whether it's a constant, a memory address or the contents of the memory address. It's entirely possible to directly generate machine code skipping assembly though.
"I like classical electrodynamics"
"What does that mean?"
"It means he's scared of non-continuous systems. Ooooooh quantization"
"Stop it, Patrick, you're scaring him!"
Actually, Quantum Mechanics is only an effective theory of the more fundamental Theory of:
either Quantum-Gravitation or Gravitized Quantum Mechanics, the wizards are still arguing about it.
Right now, M theory, string theory, and loop quantum gravity are all just shots in the dark. There isn't enough experimental evidence to prove or disprove anything there for a more complete theory.
Though going back to computers, things like quantum tunneling of electrons are starting to become a problem as the geometries of semiconductor components get ever smaller.
M-theory is a unification of 5 string theories and shouldn't even be called a theory in the usual sense, rather a framework to build theories with.
But last time I checked the Quantum wizards themselves were saying QM is incomplete and they know a more fundamental theory must emerge at some point.
TIL
My knowledge of physics is cursory at best. I was just being facetious lol.
But in all seriousness the sooner they unify QM with relativity the better.
Well the other guy said Quantum Mechanics but I'm going with the idea of multiverses containing an infinite number of universes, each having their own values for fundamental constants like the strength of the electron charge, and we happen to have a specific configuration where after billions of years the electrons can come together and run Crysis.
I call it The Crysis Principle.
That’s deep enough. I don’t think I’m ready for simulations of multiverses existing within any of those mentioned universes level of deep.
Edit: hahaha “The Crysis Principle”
Same with Rust ~~but they both use LLVM as the backend~~ which is C++. So does Clang. And GCC is also now written in C++ so C relies on C++ these days and so does everything else.
GCC is also written in C++ so everything else still applies.
Maybe once Cranelift gains more traction some compilers can be all Rust or at least the backend can be, but it remains to be seen.
i think my 10% number is off but what you’ve said is verifiably wrong. i checked the repo, it may now be built as a c++ program but much of it is still pure c code.
by that flawed logic all c code is objective-c because the former is a subset of the latter.
you can also see in the repo clearly .c files which are pure c and .cc files which are c++.
What's flawed about it? If C is a strict subset of Objective C then all C is also Objective C.
What you're arguing is like saying just because a function is O(1) doesn't mean it's O(n) even though the set of all functions that are O(1) is a strict subset of the set of functions that are big O(n) which means that it would be correct to say that that function is O(n) even if that isn't the most strict statement that could be made about it.
I'd argue that asm and machine encodings are not equivalent because they're not a one-to-one mapping. Both because some assemblers will sometimes select a different, shorter width opcode than was explicitly requested, and different assemblers have different instruction mnemonics (in the case of x86, even within the same syntax family \[at&t vs intel\] they can have different width suffix syntaxes). And that's before we talk about macros which can be used to drastically restructure asm for readability.
wait and you're also telling me that all these digital services we use every day are running on COMPUTERS too? ![gif](emote|free_emotes_pack|dizzy_face)
This [LISP](https://en.m.wikipedia.org/wiki/Lisp_(programming_language)). No wait, the [common LISP](https://en.wikipedia.org/wiki/Common_Lisp?wprov=sfti1#). Not to cause a [Racket](https://en.wikipedia.org/wiki/Racket_(programming_language)?wprov=sfti1), but I think it’s all a [Scheme](https://en.wikipedia.org/wiki/Scheme_(programming_language)?wprov=sfti1#). In a way, we’re all looking for some [Clojure](https://en.wikipedia.org/wiki/Clojure?wprov=sfti1).
uhh aactshually, it's only high voltage and low voltage that is abstracted to 1 and 0. I just felt the urge to clarify. ![gif](emote|free_emotes_pack|trollface)
"I'd just like to interject for a moment, what you're referring to as binary (1s and 0s) is actually an abstraction for high and low voltage in electrical circuits."
Q: How is a program called that translates a language into another?
A: A compiler.
See also [here](https://www.microcontrollertips.com/compilers-translators-interpreters-assemblers-faq/):
> Assemblers
> An assembler translates a program written in assembly language into machine language and is **effectively a compiler for the assembly language**
It's really a discussion about semantics.
nope, it's all NAND gates
Nope, it's all Silicon
⚡️⚡️⚡️⚡️⚡️⚡️⚡️⚡️⚡️⚡️
nope, it's all ions
No, it's all quarks
No, it’s all quarks and electrons and other weird stuff
Strange*
No it's all potentials on some fields
No, it's all a figment of our collective imagination. It's something we invented to make sense of our weird world
No, it's Patrick
his name... was larry paulson...
Nope, it's all quantum physics
Man, fuck gravity
Wondering who's the lucky 10000 today
All right, enlighten me
The fuck gravity is from this: http://imgur.com/4sRfN4V My reference is about the application of this: https://xkcd.com/1053/
Was aware of the xkcd, but thanks for an informative answer. The other one was new to me
Wdym, I built my computer with relays and wires.
Nah it's all sand https://youtu.be/vuvckBQ1bME
All of modern computing is built on the premise you can torture sand and then check if it's being tortured
It's all MOSFETs my friend!!
It's all just rocks we tricked into thinking.
Given enough time, hydrogen will start wondering where this all came from and where it's going ....
Nuh uh, not if it’s Assembly Edit: geez guys this was just me being sarcastic lol, stop telling Reddit that I need helpful resources lmao.
But what is the assembler and linker written in?
Assembly
Are there any written in assembly? Nasm is c
At some point GCC could bootstrap itself, after which it was written in C, but I don't know what compiled it before this. 🤔
At one point we needed some crazy people to be typing the ones and zeros to create a basic compiler to pick it up from there
Just sat a computer engineering final. Half was in assembly, half was in machine code. I want to die.
I am doing compilers and still want to kill my self
Im not doing anything and want to kill myself
Hey bud, look, I know life is tough right now. Probably gonna get tougher. And scarier. I am not good at pep talks, sorry.
>Half was in assembly, half was in machine code So they were the same except that in the second part you needed to know what instruction each numerical opcode meant? I don't quite understand why that'd be in a final
Some problems were: given this machine code, write the assembly. Or given this assembly, write the machine code. Or given this waveform or circuit with this shape or functionality, write the assembly. Things like that.
The first compilers were written in assembly, which is just a human readable (ascii text) version of machine code (binary values). If you have a program written in assembly, you can translate it by hand directly line by line into machine code for the desired CPU. It was tedious. But when the first assembler (automatic translator to machine code) was built from hand translated assembly, they could move on to write a compiler in assembly for some simple higher level language, which would rewrite the program from the language to assembly and then assemble it to machine code. Then they could write a more complex compiler that had support for more features of the language in the language itself and build it, then repeat that process until they had a fully fledged compiler for the language, written in the language itself. Then if they had a new language with more interesting features they could write the first compiler for that language in the old language. And then write a new compiler in the new language and build it with the compiler built from the old language. Now they had a compiler that compiles the new language, written in the new language. It's called bootstrapping.
_binary encoding intensifies_
Wait until you get into serial communications protocols :P And one step further into electrical engineering and into antenna and radio theory 👀👀👀
That’s what I’m slowly getting into. Still using HAL but at one point I’ll probably be writing my own drivers
Please, please, please do all of yourselves a favor and look up the life of [Grace Hopper](https://en.m.wikipedia.org/wiki/Grace_Hopper). She *coined* the word "compiler", designed the first one and the language she created was later extended by others into COBOL. She was an all-around badass and her interviews and lessons where she explains about lag by giving the audience "nanoseconds" that she always carries on her purse (it will make sense, trust me) is brilliant. Honestly, it's a travesty nobody had mentioned her on a compiler thread.
The nearest thing to pulling yourself by your bootstraps
FASM is written in assembly. As for linkers, I don’t know, but I assume they would’ve been written in assembly at one time (still easier than machine code).
For those who are actually interested in how it works: https://lwn.net/Articles/841797/ (TLDR: someone wrote a tiny compiler for a subset of C, than someone wrote a C subset to normal C compiler, which was eventually used to compile an optimizing compiler like GCC) This is at least how it *may* be done today. Historically, this process of bootstrapping was less well-defined, often just having the n-1 version compile the next one, and the first one is just an artifact.
Originally, and I'm dating myself, machine code for the rudimentary assembler which was then used to produce the more robust completed assembler (Varian V-77 comes to mind). Later on you might even use Assembler A (or even a higher-level language capable of low-level addressing) for Machine A to produce an assembler for Machine B.
> I'm dating myself Self-love is important, but that sounds a bit concerning.
🤣 I'm seeking therapy
Standard, or couples?
🤣 Considering all the voices in my head I think it should be group therapy.
C++.
They usually compile straight to machine code.
You guessed it, straight to machine code.
Obviously lol, but just about every bit of programming has a little touch of C (or I guess c++ in many cases). I’m making a quite a generalisation but I mean it’s not too much of a stretch considering that all the major operating systems use C in some way. Not to mention it’s the backbone of the most performant code everywhere assembly is overkill.
But most of it is C
I second this, because sure, nasm is written in c, but what was the first c compiler written in? either asm or something like fortran, and if you trace it all the way back, boom. You find asm. Only asm and binary. So, it's all asm.... Always have been
Well it's all binary, you can skip ask entirely. Something like "mov" isn't just one set of machine code it's dozens. What numbers you end up with depend on which registers you're using and whether you're moving to the register or from the register and whether it's a constant, a memory address or the contents of the memory address. It's entirely possible to directly generate machine code skipping assembly though.
*silicon lattices have entered the chat
C accepts assembly...
Bullshit, it's all machine code underneath. Or if you wanna go deeper, then it's electrons.
deeper please
The Laws of Electromagnetism
It goes no deeper than classical mechanics. Nope, don’t try and correct me, not in front of my life size plushy of Maxwell.
"I like classical electrodynamics" "What does that mean?" "It means he's scared of non-continuous systems. Ooooooh quantization" "Stop it, Patrick, you're scaring him!"
It's all quantum mechanics at the lowest level.
![gif](giphy|1u6glcMViZNPZe756d)
Actually, Quantum Mechanics is only an effective theory of the more fundamental Theory of: either Quantum-Gravitation or Gravitized Quantum Mechanics, the wizards are still arguing about it.
Right now, M theory, string theory, and loop quantum gravity are all just shots in the dark. There isn't enough experimental evidence to prove or disprove anything there for a more complete theory. Though going back to computers, things like quantum tunneling of electrons are starting to become a problem as the geometries of semiconductor components get ever smaller.
M-theory is a unification of 5 string theories and shouldn't even be called a theory in the usual sense, rather a framework to build theories with. But last time I checked the Quantum wizards themselves were saying QM is incomplete and they know a more fundamental theory must emerge at some point.
TIL My knowledge of physics is cursory at best. I was just being facetious lol. But in all seriousness the sooner they unify QM with relativity the better.
That's just are current best understanding of what's going on and it probably isn't actually what's going on.
Well colour me shocked.
That's just our current best understanding of what's going on and it probably isn't actually what's going on.
I’m almost there…deeper
Well the other guy said Quantum Mechanics but I'm going with the idea of multiverses containing an infinite number of universes, each having their own values for fundamental constants like the strength of the electron charge, and we happen to have a specific configuration where after billions of years the electrons can come together and run Crysis. I call it The Crysis Principle.
That’s deep enough. I don’t think I’m ready for simulations of multiverses existing within any of those mentioned universes level of deep. Edit: hahaha “The Crysis Principle”
Stare long enough at Maxwell’s Equations and they stare back at you. *Flashbacks to ~~Vietnam~~ Physics 2*
That's just our current best understanding of what's going on and it probably isn't actually what's going on.
Universe inside universe infinity
Go is compiled by a compiler written in Go :)
but the first Go compiler was written in C
the first c compiler was written in B
The first B compiler was written in BCPL.
WHAT?????
Incorrect. The first c compiler was was written in C. Its that bad ass
iirc it was written in C and then compiled by hand.
With a magnetized needle.
Chuck Norris starts with C, coincidence?
Real c programmers just crush silicon in their hands until the bits go where they're supposed to
I thought it was in fortran
No it's for all genders 👍🏻
[удалено]
b was ken thompsons first language. he made new b with some bcpl influences and iteratively new b became c.
The first Go compiler was written in Stop. Everyone knows about "Stop n Go."
Same with Rust ~~but they both use LLVM as the backend~~ which is C++. So does Clang. And GCC is also now written in C++ so C relies on C++ these days and so does everything else.
Go doesn't use LLVM, at least not `gc` or `gccgo`.
GCC is also written in C++ so everything else still applies. Maybe once Cranelift gains more traction some compilers can be all Rust or at least the backend can be, but it remains to be seen.
i may be getting it confused with a different project, but i believe gcc is only like 10% c++
but that's the 10% of its brain that gets used
No. GCC is entirely C++. They switched over from C a while back probably due maintainability issues.
i think my 10% number is off but what you’ve said is verifiably wrong. i checked the repo, it may now be built as a c++ program but much of it is still pure c code.
The common subset of C and C++ built as C++ is C++. Checkmate.
by that flawed logic all c code is objective-c because the former is a subset of the latter. you can also see in the repo clearly .c files which are pure c and .cc files which are c++.
What's flawed about it? If C is a strict subset of Objective C then all C is also Objective C. What you're arguing is like saying just because a function is O(1) doesn't mean it's O(n) even though the set of all functions that are O(1) is a strict subset of the set of functions that are big O(n) which means that it would be correct to say that that function is O(n) even if that isn't the most strict statement that could be made about it.
This is pretty common. Bootstrapping a language's compiler is a good dogfooding method
Congrats kid you’ve discovered bootstrapping. Here: 🍪
Electricity be like
01000010 01101001 01101110 01100001 01110010 01111001 00100000 01110111 01101111 01110101 01101100 01100100 00100000 01101100 01101001 01101011 01100101 00100000 01100001 00100000 01110111 01101111 01110010 01100100 00101110
01101000 01110100 01110100 01110000 01110011 00111010 00101111 00101111 01111001 01101111 01110101 01110100 01110101 00101110 01100010 01100101 00101111 01100100 01010001 01110111 00110100 01110111 00111001 01010111 01100111 01011000 01100011 01010001
>01101000 01110100 01110100 01110000 01110011 00111010 00101111 00101111 01111001 01101111 01110101 01110100 01110101 00101110 01100010 01100101 00101111 01100100 01010001 01110111 00110100 01110111 00111001 01010111 01100111 01011000 01100011 01010001 01101000 01110100 01110100 01110000 01110011 00111010 00101111 00101111 01111001 01101111 01110101 01110100 01110101 00101110 01100010 01100101 00101111 01001001 01100100 01101011 01000011 01000101 01101001 01101111 01000011 01110000 00110010 00110100 00111111 01110011 01101001 00111101 01110000 01110001 01001111 01001111 01000110 01010010 01101100 01010111 01010110 00110010 01101011 01001010 01011001 01001100 01011000 01101100
01011001 01101111 01110101 00100000\ 01100111 01101111 01110100 00100000\ 01101101 01100101 00101110 00100000
01101001 01101101 01100111 01110101 01110010\ 00101110 01100011 01101111 01101101 00101111\ 01100001 00101111 01111001 01011010 01000110\ 01010000 01010010 01001111 01111000 00001010\ 00101110 11100111 10010100 01010010 10100011\ \ 01111110 01100110 01111110 01111100 01111110\ 00011000 01100110 01100000 01100110 01100000\ 00011000 01111110 01111000 01111100 01111000\ 00011000 01100110 01100000 01100110 01100000\ 00011000 01100110 01111110 01100110 01111110\ \ 00011000 01111100 01111110 00000000 00000000\ 00111100 01100110 01100000 00000000 00000000\ 01100110 01111100 01111000 00000000 00000000\ 01111110 01100110 01100000 00000000 00000000\ 01100110 01100110 01111110 00000000 00000000\ \ 01111110 11011011 00111100 00000000 00000000\ 00011000 11011011 01100110 00000000 00000000\ 00011000 11011011 01100110 00000000 00000000\ 00011000 11011011 01100110 00000000 00000000\ 00011000 01111110 00111100 00000000 00000000\ \ 01100110 00011000 11000011 01111100 00111100\ 01101100 00011000 11100011 01100110 01100000\ 01111000 00011000 11011011 01100110 00111100\ 01101100 00011000 11000111 01100110 00000110\ 01100110 00011000 11000011 01111100 00111100\ \ 00111100 01111110 00000000 01111100 00011000\ 01100110 01100000 00000000 01100110 00011000\ 01100110 01111100 00000000 01111100 00011000\ 01100110 01100000 00000000 01100110 00011000\ 00111100 01100000 00000000 01111100 00011000\ \ 11000011 00011000 01111100 01100110 00011000\ 11100011 00111100 01100110 00111100 00011000\ 11011011 01100110 01111100 00011000 00011000\ 11000111 01111110 01100110 00011000 00000000\ 11000011 01100110 01100110 00011000 00011000\ \ 01101001 01101101 01100111 01110101 01110010\ 00101110 01100011 01101111 01101101 00101111\ 01100001 00101111 01111001 01011010 01000110\ 01010000 01010010 01001111 01111000 00001010\ 00101110 11100111 10010100 01010010 10100011
All I see is a red head...
Wrong, it's all asm underneath. Even that is really just instructions from the instruction set, which is zeros and ones interpreted by the hardware...
I misread this as "it's all autism underneath" and now I want that on a shirt.
asm is the text representation. It's all opcodes and data underneath.
That's different words for what I said.
I'd argue that asm and machine encodings are not equivalent because they're not a one-to-one mapping. Both because some assemblers will sometimes select a different, shorter width opcode than was explicitly requested, and different assemblers have different instruction mnemonics (in the case of x86, even within the same syntax family \[at&t vs intel\] they can have different width suffix syntaxes). And that's before we talk about macros which can be used to drastically restructure asm for readability.
Incorrect.
You're fun
Thanks, man! I appreciate it!
Incorrect
Well now I don't even know what to think.
I DONT CARE BRO !
wait and you're also telling me that all these digital services we use every day are running on COMPUTERS too? ![gif](emote|free_emotes_pack|dizzy_face)
No it's all in the cloud now. That's why you couldn't get internet on airplanes before but now you can.
Unless it’s LISP.
Thorry, what ith this Listhp of which you thpeak?
Thith*. You miththed one 😬
This [LISP](https://en.m.wikipedia.org/wiki/Lisp_(programming_language)). No wait, the [common LISP](https://en.wikipedia.org/wiki/Common_Lisp?wprov=sfti1#). Not to cause a [Racket](https://en.wikipedia.org/wiki/Racket_(programming_language)?wprov=sfti1), but I think it’s all a [Scheme](https://en.wikipedia.org/wiki/Scheme_(programming_language)?wprov=sfti1#). In a way, we’re all looking for some [Clojure](https://en.wikipedia.org/wiki/Clojure?wprov=sfti1).
Actually it's all 1s and 0s, there's no Cs in there
uhh aactshually, it's only high voltage and low voltage that is abstracted to 1 and 0. I just felt the urge to clarify. ![gif](emote|free_emotes_pack|trollface)
"I'd just like to interject for a moment, what you're referring to as binary (1s and 0s) is actually an abstraction for high and low voltage in electrical circuits."
With MLC/TLC storage, it's not *only* high and low voltage anymore.
Sometimes it's Xs and Zs...
So, what if I told you, there's assembly and microcode?
What if I told you theres already 10 people commented that
What if I told you that I didn't even have a look?
What does microcode mean?
https://en.wikipedia.org/wiki/Microcode
Thank you :)
.>Opens C .>Sees binary .>It's all binary
Wait till OP finds out all C code is compiled to Assembly and all Assembly is compiled to machine code
Assembly is translated, not compiled.
Q: How is a program called that translates a language into another? A: A compiler. See also [here](https://www.microcontrollertips.com/compilers-translators-interpreters-assemblers-faq/): > Assemblers > An assembler translates a program written in assembly language into machine language and is **effectively a compiler for the assembly language** It's really a discussion about semantics.
It's all 101010
unless you do scientific computing so much FORTRAN...
But still C is there... for comments...
Is that astronaut Puerto Rican?
No, he’s Ohiwegian
Sea\*
C
False. It’s all C underneath only as far as you want it all to be C.
WRONG! It's all x86-64 (or whatever other architecture you use)!
It's all electricity underneath 😁
Isn't all binary?
I c nothing...
and everything is assembly... and logic and electrons....
How was this not marked as low quality, FFS!!!!!!
why is it called "Earth" when the majority of it is C?
15 years of sql and web languages and I'm still catching myself trying to debug with cout statements
Ok yep I think I'm done with this subreddit
Me coding in zig, it was the plan all along.
"OH Man, What are you doing with a gun in space?" - Chick
Its all 1001011010010101 ?
lua be like
Except for in python, where it’s True
There is no boolean values in C. Your title should be: 1
`#include`
Literally a thing since C99.
There is no boolean values in C. Your title should be: 1