Live data from Hacker News

Dennis Ritchie's first C compiler on Github

github.com

21–30 of 88 posts

Re: Dennis Ritchie's first C compiler on Github

#21
post #2

Is this written in C? If so, what compiled this? Sorry for the noob question, I'm just a little lost.

From the link on GitHub: http://cm.bell-labs.com/cm/cs/who/dmr/primevalC.html Which led me to here: http://cm.bell-labs.com/cm/cs/who/dmr/chist.html Where, if you take the time, you will find a wonderful story, upon completing, you will probably know more about the early embryonic history of C then 95% of your peers. (Spoiler - We start with BCPL, then Move to B - it's left as an exercise to determine how we original…

> (Spoiler - We start with BCPL, then Move to B - it's left as an exercise to determine how we originally compiled BCPL)

The first version of Go started with B: http://code.google.com/p/go/source/detail?r=f6182e5abf5e

The second revision was converted to C: http://code.google.com/p/go/source/detail?name=f6182e5abf5e&...

The third to Draft-Proposed ANSI C: http://code.google.com/p/go/source/detail?name=f6182e5abf5e&...

And the fourth to ANSI C: http://code.google.com/p/go/source/detail?name=f6182e5abf5e&...

Re: Dennis Ritchie's first C compiler on Github

#22
post #9
post #3

Earlier quoted context omitted.

It compiles itself! http://en.wikipedia.org/wiki/Bootstrapping_(compilers)

I understand bootstrapping, but at some point there has to exist some outside compiler in another language or a hand-compiled version of this otherwise the chicken and egg chain never ends.

The very first compilers were tediously written in assembly. Bill Gates wrote his first version of Basic in assembly. I believe all early Fortran compilers were written in direct machine code through punch cards! Coding in assembly is not all that bad :). Once you got some compiler going, you can write more complex compiler with it and keep adding more syntactic sugar :).

Re: Dennis Ritchie's first C compiler on Github

#23

Earlier quoted context omitted.

From the link on GitHub: http://cm.bell-labs.com/cm/cs/who/dmr/primevalC.html Which led me to here: http://cm.bell-labs.com/cm/cs/who/dmr/chist.html Where, if you take the time, you will find a wonderful story, upon completing, you will probably know more about the early embryonic history of C then 95% of your peers. (Spoiler - We start with BCPL, then Move to B - it's left as an exercise to determine how we original…

> (Spoiler - We start with BCPL, then Move to B - it's left as an exercise to determine how we originally compiled BCPL) The first version of Go started with B: http://code.google.com/p/go/source/detail?r=f6182e5abf5e The second revision was converted to C: http://code.google.com/p/go/source/detail?name=f6182e5abf5e&... The third to Draft-Proposed ANSI C: http://code.google.com/p/go/source/detail?name=f6182e5abf5e&..…

They definitely messed up with a conversion from Subversion to Mercurial. ;)

Re: Dennis Ritchie's first C compiler on Github

#24

He already used the right brace style (hanging braces, cuddled else) and the right indentation (tabs, not spaces).

Somehow over the years learning C on my own, perhaps because it seemed more consistent to me, I got used to writing

    if(foo) {
omitting the space after control statements' names, which is almost never done - except in very early C code. (It's not just this: V7 Unix often omits the space as well.). I should probably settle on a less idiosyncratic personal style, but I can't help but take a little heart from seeing "my" style in such a famous codebase. :)

Re: Dennis Ritchie's first C compiler on Github

#25
post #9
post #3

Earlier quoted context omitted.

It compiles itself! http://en.wikipedia.org/wiki/Bootstrapping_(compilers)

I understand bootstrapping, but at some point there has to exist some outside compiler in another language or a hand-compiled version of this otherwise the chicken and egg chain never ends.

The mysterious true origins of bootstrapping compilers.

Re: Dennis Ritchie's first C compiler on Github

#27

He already used the right brace style (hanging braces, cuddled else) and the right indentation (tabs, not spaces).

Indentation, yes. Braces, no. He uses K&R style because he was the R (obviously). But nothing new is being written in K&R C these days, favouring ANSI C (99/11 or 89 if you're stuck on cl) with usually Allman/KNF style or a variation thereof instead.

Re: Dennis Ritchie's first C compiler on Github

#28
post #24

He already used the right brace style (hanging braces, cuddled else) and the right indentation (tabs, not spaces).

Somehow over the years learning C on my own, perhaps because it seemed more consistent to me, I got used to writing if(foo) { omitting the space after control statements' names, which is almost never done - except in very early C code. (It's not just this: V7 Unix often omits the space as well.). I should probably settle on a less idiosyncratic personal style, but I can't help but take a little heart from seeing "my"…

Never using a space before the paren is more consistent. I don't know why people put a space there...

Re: Dennis Ritchie's first C compiler on Github

#29
post #24

He already used the right brace style (hanging braces, cuddled else) and the right indentation (tabs, not spaces).

Somehow over the years learning C on my own, perhaps because it seemed more consistent to me, I got used to writing if(foo) { omitting the space after control statements' names, which is almost never done - except in very early C code. (It's not just this: V7 Unix often omits the space as well.). I should probably settle on a less idiosyncratic personal style, but I can't help but take a little heart from seeing "my"…

    if(foo)
I avoid doing this because it looks like a function call.

Re: Dennis Ritchie's first C compiler on Github

#30

Earlier quoted context omitted.

From the link on GitHub: http://cm.bell-labs.com/cm/cs/who/dmr/primevalC.html Which led me to here: http://cm.bell-labs.com/cm/cs/who/dmr/chist.html Where, if you take the time, you will find a wonderful story, upon completing, you will probably know more about the early embryonic history of C then 95% of your peers. (Spoiler - We start with BCPL, then Move to B - it's left as an exercise to determine how we original…

> (Spoiler - We start with BCPL, then Move to B - it's left as an exercise to determine how we originally compiled BCPL) The first version of Go started with B: http://code.google.com/p/go/source/detail?r=f6182e5abf5e The second revision was converted to C: http://code.google.com/p/go/source/detail?name=f6182e5abf5e&... The third to Draft-Proposed ANSI C: http://code.google.com/p/go/source/detail?name=f6182e5abf5e&..…

Uh these commits seem interesting, but I don't quite understand the context. What's macho and what is its relation to go? Are the dates way off or is it an import of older history?
Post reply on HN