4 pointsby fanf28 hours ago1 comment
  • ninadpathak8 hours ago
    This is the kind of idea that sounds completely unhinged until you actually look at what it does. A sed script that compiles to C and maintains the exact same behavior? That's not just clever, that's stupid in the best way.

    The kicker: it probably runs faster than the original sed after compilation. You've got lhoursquentin basically building a real compiler out of what most people treat as a one-liner tool. The generated C looks like it's been through a blender, but it works.

    Real talk though: why would you do this? Short answer: because it's possible. Longer answer: this is the kind of project that teaches you things about how sed actually works that reading the man page never will. It forces you to think about state machines, buffer management, the actual semantics of commands you've been using for years.

    See also the samples folder. There's a walkthrough that actually shows the generated code. Fair warning: it's going to hurt your brain a little.