56,000 lines of DOOM, in a language I made up

(betlang.dev)

28 points | by ghuntley 4 hours ago ago

16 comments

  • andai 3 hours ago ago

    Excellent. At last, I can I confess a far worse crime.

    Late 2020, pre-AI, which I'm not sure if that makes it better or worse...

      #include "uwu.h"
      #include <stdio.h>
    
      iwint main() stawt
          iwint owo is 5 yiff
          fuw (iwint uwu is 0 yiff uwu smol owo yiff uwu incwease) stawt
              owo is owo wif uwu yiff
              spweak nuwumber_fowmat, owo spwake yiff
          stawp
      stawp
    
    --

      // uwu.h
    
      #define is =
      #define yiff ;
      #define stawt {
      #define stawp }
      #define fuw for
      #define iwint int
      #define wif +
      #define wiffout -
      #define smol <
      #define larg >
      #define incwease ++
      #define spweak printf(
      #define spwake );
      #define nuwumber_fowmat "%d\n"
    
    Obviously this one also runs DOOM ;)
    • kmoser an hour ago ago

      I did this in 1989, as if C had been written by the folks who brought you COBOL:

        #include <stdio.h>
      
        #define OpenBrace {
        #define CloseBrace }
        #define OpenBracket [
        #define CloseBracket ]
        #define OpenParenthesis (
        #define CloseParenthesis )
        #define NoReturnType void
        #define NoParameter NoReturnType
        #define MainFunction main
        #define Semicolon ;
        #define FunctionPrototype
        #define ActualFunction
        #define PointerTo(atype) atype*
        #define OutputToStdout(astring) printf(astring)
        #define IsEqualTo =
      
        FunctionPrototype NoReturnType
        MainFunction OpenParenthesis NoParameter CloseParenthesis Semicolon
      
        ActualFunction NoReturnType
        MainFunction OpenParenthesis NoParameter CloseParenthesis
        OpenBrace
          PointerTo(char) string IsEqualTo "Now is the time for all good men, etc.\n" Semicolon
          OutputToStdout(string) Semicolon
        CloseBrace
    • jraph 3 hours ago ago

      I did the same thing, shouting.h, defined the uppercase version of many types and keywords.

      Had a good uncontrolled laugh during a team presentation with a colleague. It was a bit disrespectful for the poor presenter who had nothing to do with this…

      Can't find shouting.h anymore unfortunately.

    • giancarlostoro 41 minutes ago ago

      Reminds me of my "BASIC" #define statements I made in college to make C look slightly more BASIC-like, I think everyone does this the moment they realize they can do this in C.

    • Cshaya 3 hours ago ago

      this gave me such a good chuckle :p

    • subscribed 2 hours ago ago

      uwu, this is amazing ;3

    • Tallain an hour ago ago

      Thanks! I hate it!

      In awe at whatever inspired this though

  • bentt 3 hours ago ago

    This is a good example of where it’s important to be more up front about the role of AI in the making of a thing.

    Making a language that compiles through LLVM is no small task and takes a lot of expertise. Most of the time people do it because they have a point of view and are highly technical.

    Making a joke language via AI is an entirely different exercise. Not without value but not the same, especially when evaluating what it means about the author.

    • NuclearPM 2 hours ago ago

      I made a “fully” functioning programming language that is kind of like Rebol on luajit using Claude code - and I haven’t really done much serious programming since college 20 years ago. It’s fun though.

    • engineer_22 an hour ago ago

      > This is a good example of where it’s important to be more up front about the role of AI in the making of a thing.

      Maybe, but we don’t always discuss our tool stack before showing our work because a lot of times it’s assumed or not interesting. AI is a tool, it’s a lever that you push on to multiply your effort. The product of your effort speaks for itself, as it always has.

  • Retr0id 3 hours ago ago

    It's cool that AI lets you cheaply experiment with language design, but I wish people would stop using it for the writeups, too.

    Buried near the end is a mention of per-frame arena allocation, which is an interesting idea for a game engine (although not a novel one).

  • ahmadyan 23 minutes ago ago

    Nicely done Geoffrey, I think we are coming full circle, instead of porting projects to different languages (for whatever) like going from zig -> rust -> zig, now we can also add additional hops like zig -> rust -> curse -> ts -> ocaml -> english -> zig.

    Thank you for keeping the token furnace burning!

  • rebolek 3 hours ago ago

    What if I don't `evict`? How different is it from forgetting to `free`?

  • jdw64 3 hours ago ago

    I'm writing the C backend by hand and using AI for the rest, so how did this author manage to finish an entire language in just 34 hours? I've been steadily catching and fixing what the AI writes, so it's amazing to me that they ended up with a complete language. It makes me wonder if the way I'm building a compiler is just wrong.

    • swiftcoder 3 hours ago ago

      If you tell it to write a spec -> then write the tests -> then implement, the LLM should be able to pretty much one-shot a compiler frontend. LLMs really benefit from the kind of task that has a built-in validation loop.

      • jdw64 3 hours ago ago

        I'm working on something similar, but unlike the author, my progress has been pretty slow. It's tough. I do write about a fifth of the code myself, but I keep getting stuck on the rest.