1. 43
  1.  

  2. 6

    Author here, happy that someone finds this interesting and happy to answer questions.

    1. 6

      While Fennel does use other files for tests, fennelview, and the CLI tool, the compiler itself is a single Lua file.

      1. 5

        Related:

        picol, a Tcl interpreter in 550 lines of C code

        http://oldblog.antirez.com/page/picol.html

        1. 5

          Jones’s Forth implementation is one file: https://github.com/nornagon/jonesforth/blob/master/jonesforth.S

          Also microkanren a logic programming language https://github.com/jasonhemann/microKanren-DLS-16/blob/master/mk.rkt

          1. 4

            You might consider including TRAC - a fascinating language by Calvin Moers, that proves at the very least that making something FLOSS will protect against total extinction.

            His actual implementation of TRAC died with him since he kept it 100% proprietary.

            1. 4

              I’ll have to polish up tinscript and get it on a github repository or somewhere where the source is inspectable, other than just “inspect source” that page. It’s a small language (less than 1K of Javascript), though it’s barely turing complete.

              1. 3

                I’d love to find a single-file Prolog, preferably in C. I’m sure this exists.

                1. 9

                  I built and ran this last year, but I don’t have any strong memories of it:

                  https://news.ycombinator.com/item?id=12193694

                  Except it’s actually in C++ and not C.

                  Somewhat related:

                  https://github.com/frankmcsherry/blog/blob/master/posts/2018-05-19.md

                  https://github.com/rust-lang/datafrog

                  1. 1

                    Thanks! Seems worth a try.

                  2. 3

                    Not C but nmh’s “LISPy things you can do in 64K bytes of core” describes an implementation in Kilo LISP’s extremely constrained conditions. The source is under 100 lines.

                  3. 3

                    oh, neat, mLite adds to my small collection of languages with ML-style (and ML-syntaxed) algebraic datatypes but dynamic typing (pyret and pure are the other two).

                    1. 1

                      I’ve been searching for a single-file implementation of ML in Standard ML that I once came across several years ago. I think it was written in the form of an email message or memo between developers of MLton or SML/NJ. Maybe it was Matthew Fluet or Andrew Appel? Has anyone else seen this?

                      1. 2

                        Appel writes a compiler for Tiger (an ML-derivative) in his Modern Compiler Implementation books, maybe that’s what you’re looking for?

                        1. 1

                          No, I’m familiar with Appel’s books but I’m remembering something that was an electronic ephemera, literally just a page of text, and only a fragment of the ML that Tiger supports.

                      2. 1

                        It’s a fun excercise. Many years ago I implemented a parser and interpreter for a simple imperative language in 120 lines of python including comments. I don’t have the source any longer, but I really learned a lot.