Compiler for the B Programming Language

85 points by ycuser2 3 weeks ago | 23 comments
  • pveierland 2 weeks ago
    • treyd 2 weeks ago
      Interesting that this is in a self-developed subset/dialect of Rust called Crust which attempts to treat it as a better C, using unsafe everywhere among other things.
      • kzrdude 2 weeks ago
        That's a little bit interesting. It remains then a C-like language with generics, and that sounds a lot more fun than regular C. I don't yet understand the point of avoiding references or libstd, though.
        • int_19h 2 weeks ago
          Avoiding references means avoiding the borrow checker, and I don't think you can use much of stdlib if you avoid references...
          • lkuty 2 weeks ago
            At the beginning of one of his videos on Crust, he's trying to avoid stdlib exactly for that reason.
        • IshKebab 2 weeks ago
          I don't know why you'd see that as desirable and not use Zig. Unsafe Rust is actually harder to get right than C or Zig.
          • month13 2 weeks ago
            This is mainly for fun, really.

            Tsoding's main lesson is how simple systems can be and the desire and demand for complex build systems is silly.

            • IshKebab 2 weeks ago
              > the desire and demand for complex build systems is silly

              No it isn't. "Simple" build systems like Make don't solve many of the problems that "complex" build systems like Bazel do.

              At my current company I tried to convince my boss at the start of our project to use Bazel (it's very difficult to change build systems once your project is big), because I knew from experience it would solve many problems we would eventually run into.

              He wouldn't let me and wanted to keep things "simple". Guess what happened? Now we have to run dozens of hours of CI just to fix a typo in a comment. CI regularly breaks because people forget dependencies. Etc.

        • avmich 2 weeks ago
          A pretty recent work: https://github.com/sergev/BCause .
          • int_19h 2 weeks ago
            Nice, but it really needs to be written in B and self-hosted.
            • aap_ 2 weeks ago
              Always nice to see more B. Here's mine: https://github.com/aap/b
              • elvircrn 2 weeks ago
                Had a go at this a while back: https://github.com/elvircrn/bcomp.
                • louis771 2 weeks ago
                  Hate to see Tsoding was using Rust for this. Rust is as far removed from recreational programming than any other language.
                  • desumeku 2 weeks ago
                    It's not rust. It's crust. https://github.com/tsoding/crust

                    "The Rules of Crust

                    Every function is unsafe. No references, only pointers. No cargo, build with rustc directly. No std, but libc is allowed. Only Edition 2021. All user structs and enums #[derive(Clone, Copy)]. Everything is pub by default."

                    • paddw 2 weeks ago
                      I think Rust is quite a recreational language.

                      The least recreational languages are probably like Java,C#

                      • renerick 2 weeks ago
                        Idk, java maybe, but c# doesn't even require .csproj files nowadays, it's really nice to use
                      • IshKebab 2 weeks ago
                        Why? It's a great language. Very productive. Ideal for compilers too.
                        • sureglymop 2 weeks ago
                          Is this satire or did you actually watch the streams?

                          He doesn't actually use rust "idiomatically". He calls this "crust":

                          1. Every function is unsafe

                          2. No references, only pointers

                          3. No cargo, just rustc

                          4. No std, only libc

                          ...

                          I don't know if he is sticking to these rules throughout but that was the idea in the beginning of this project.

                          https://github.com/tsoding/Crust

                        • DiabloD3 2 weeks ago
                          This is the most tsoding thing possible.
                          • nurettin 2 weeks ago
                            I have tsoding fatigue at this point. BTW are you the DiabloD3 from freenode/#sdl like 25 years ago?
                        • ZeroAurora 2 weeks ago
                          [dead]