eqvinox 3 days ago

Holy cow this is —structurally, not just expression— some of the worst C code I have ever seen, with the abuse of the 'double' type, 'T' cast that looks like a declaration, endian dependency, and strict aliasing violations galore… does this even work on a modern compiler? o.O

  • f1shy 2 days ago

    Certainly not the worst I have seen, by far; but yes, not pretty. IMHO “Just for making it shorter“. I would very much prefer 200 lines of actually readable nice code.

    • sevensor 2 days ago

      For reading, I enjoyed fe, which was very clear: https://news.ycombinator.com/item?id=36239175

      • f1shy 2 days ago

        Yes! Exactly what I meant. 700 lines, but of code that can be understood, and looks clearly as C. Also btw, the general file structure, the documentation, I prefer fe any day of the week. Thanks for pointing that out, I will take a look at it.

  • messe 2 days ago

    Surpringly readable though, despite all that, if you've ever implanted a language in similar constraints.

    • messe 2 days ago

      *implemented.

      Too late to edit now.

  • OhMeadhbh 3 days ago

    Yeah. It's munged to fit in 99 lines.

    • eqvinox 3 days ago

      That's besides my point, which is why I said "structure, not just expression".

      It could've used a struct rather than wedging tags into a double's first byte and still be 99 lines.

      • fami-com 2 days ago

        That's a standard technique in interpreters. All non-toy Javascript engines use it, for example.

      • Spivak 2 days ago

        If that's the trick you object to then you will be sad to hear that Ruby uses it.

lisper 3 days ago

Lisp in ~100 lines of Python:

https://flownet.com/ron/l.py

  • ginko 2 days ago

    Can’t you just “import lisp”?

    • lisper 2 days ago

      Um, no?

          Python 3.11.6 (v3.11.6:8b6ee5ba3b, Oct  2 2023, 11:18:21) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
          Type "help", "copyright", "credits" or "license" for more information.
          >>> import lisp
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
          ModuleNotFoundError: No module named 'lisp'
forgotpwd16 2 days ago

>C code in this project is strongly Lisp-like in compact form

Kinda reminds me J-flavored Whitney's one-page J interpreter.

mark_l_watson 2 days ago

The commented longer program listing was fun to read.