Skip Navigation
Jump
Why am I writing a Rust compiler in C?
  • It makes sense that if you're designing a language, you'd like the language you made and would want to use it. It's fine for compilers like that to exist, and even be the main one used, but ideally it shouldn't be the only compiler.

    But there are technically ways to bootstrap a language without writing it in another language (other than a small core in assembly or something). You could design a tiny compiler that only handles a small subset of your language, then write a better compiler using only the features available in that subset. You can do this for several layers of compilers until you have the full language.

    4
  • Jump
    Why am I writing a Rust compiler in C?
  • That's already how it is now, we just don't usually think of it that way. You can't compile rust unless you already have a rust compiler. The current version was compiled in a previous version, which was compiled in a previous version, going through a chain of older versions and other languages. Anything along that chain could've theoretically had an influence on the current compiler.

    It's not about the code itself being more trustworthy. The point is that when you bootstrap, you don't have to blindly trust any of the binaries, since it's source code the whole way down. Someone could bootstrap rustc like this, compare it to the binaries that already exist, and ideally they would be identical.

    8
  • Jump
    Why am I writing a Rust compiler in C?
  • A lot of this bootstrapping stuff comes back to the 'trusting trust' attack. You could write a compiler that adds some malicious code to programs it compiles. But the thing is, it could also insert it's own malicious code when compiling a compiler. So you look at your code, and the code of your compiler, and everything looks fine, but the exploit is still there. Someone wrote an example in rust.

    Theoretically there could also be bugs that propagate this way. So to fully trust your code is doing what you think it is, you'd need a chain of compilers back to hand coded assembly.

    18
  • Jump
    Why am I writing a Rust compiler in C?
  • Yeah, I wrote the wrong language. I tend to lump those together in my head as 'big multi-paradigm languages I haven't bothered to learn yet.'

    1
  • Jump
    Why am I writing a Rust compiler in C?
  • You can technically do it, but it's a convoluted path. The article talks about it. Basically to bootstrap that way you need to go through a lot of versions of rust, compile rust 0.7 in ocaml, compile ocaml in scheme, and compile scheme in C using gcc. For gcc you need to compile a chain of versions back to when it was written in C instead of C++, plus the whole TinyCC bootstrapping path.

    edit: had listed scala instead of ocaml

    11
  • Jump
    Why am I writing a Rust compiler in C?
  • The main thing is that TinyCC has already been bootstrapped.

    Check out this page on bootstrappable.org. Basically they start with a 200 something byte binary (hex0) that can act as an assembler, then using a bunch of layers of tools and compilers you can bootstrap a whole system. I think they use stage0 to build M2-Planet, use that to build GNU Mes, and use that to build TinyCC.

    So a project like this fits neatly into that bootstrapping path. It could be done other ways, but starting from a fairly complete C compiler makes it a lot easier than building an entire path from scratch.

    29
  • Jump
    GIMP 3.0 Enters String Freeze, Inching Closer To Release
  • The biggest thing is probably non-destructive editing, so you can do stuff like apply filters without them changing the underlying image. Gtk3 should add better support for tablets and wayland. There's also better layer tools and font support. A lot of it was on the backend, which should eventually allow for using other color spaces like cmyk natively.

    10
  • Jump
    GIMP 3.0 Enters String Freeze, Inching Closer To Release
  • It's too bad that GLIMPSE fork never took off.

    10
  • Jump
    GIMP 3.0 Enters String Freeze, Inching Closer To Release
  • They've been working on porting it since back in 2012, and didn't want to redo a bunch of the porting work before they even released it.

    10
  • Jump
    Keyboard shortcuts visualization
  • I'm not sure if it's directly mapping the input. I think it's getting the other keys input and binding it to the same commands. Also, Emacs was around even before the X windowing system, so they probably came up with the mappings before a lot of these common defaults came about.

    2
  • Jump
    Keyboard shortcuts visualization
  • Meta, Hyper, and Super were all originally different keys. See this lisp machine keyboard from in the 70s that had 7 modifiers, including all of those. Most of the time Hyper or Super are mapped to the Windows key. With Meta it varies more from program to program. A lot of desktop software maps it to the Windows key. In Emacs its usually mapped as Alt or the Esc key.

    4
  • Jump
    I created a simple Creative Commons sites index with high hopes.
  • If you're looking for more sources for your site, Wikimedia Commons has a page with lists of sources for freely licensed media, sorted by content type. The photography list in particular is really long, and sorted into categories.

    1
  • Jump
    Can whales eat humans?
  • Cladistically dolphins are a type of toothed whale. They're more closely related to species like sperm whales than toothed whales and baleen whales are to each other.

    31
  • Jump
    Fuck all cops, but should we really be calling them bastards?
  • There's still tons of people who will judge you for having children without getting married. A lot of religious groups still consider it a moral failure. And even if it was completely accepted now, it still became an insult in the first place because of that stigma, and you'd still be using it within that historical context. You can't reclaim a slur by continuing to use it as an insult and ignoring where it comes from.

    As an example, I've seen pretty many people use slurs for Romani people as a term for getting scammed or cheated. Usually they didn't know the origin of the term, and didn't mean any harm by it. They had heard it being used and assumed it was just another word. But you don't just accept the definition these people have in their heads as an alternate definition, disconnected from the original. It has the meaning it does based on bigoted stereotypes, and by using it they're still spreading that, even if they aren't hateful themselves.

    1
  • Jump
    Word to replace "weird" when used in a positive context
  • It usually implies it's weird in an old-fasioned way though.

    8
  • Jump
    End of an era: Nova Launcher's parent company lays off practically everyone
  • I've had it freeze up on me several times, where I had to reset the app to get it working again. It works most of the time, but I wouldn't recommend it yet for general use.

    11
  • Jump
    Best android app suggestions?
  • Hacker's Keyboard hasn't had a real release in about 5 years, so it can be slightly buggy.

    Unexpected Keyboard is pretty good. It's got the complete keyboard layout available including stuff like Control and Function keys, so I think it's an acceptable replacement. It uses swipes to type other keys, which I'm not sure if I prefer, but it works well enough. I set the swipe distance higher because I would accidentally swipe from time to time.

    2
  • Jump
    What web browser extensions would you highly recommend to others?
  • If you check "I'm an advanced user" in the settings, then hit the "More" button in the dropdown a few times it'll show the more advanced interface that lets you choose which third party domains to allow. It doesn't work quite the same since it blocks both content and scripts per site, but I find it good enough for my usage.

    edit: You can technically block just scripts per 3rd party site, but it involves manually editing the content type for your rules in the settings. It's not part of the main interface, so I never bother using it.

    2