25 comments

  • dang5 hours ago
    Is it classics day or something? (Fine with us!)<p>Related:<p><i>(How to Write a (Lisp) Interpreter (In Python)) (2010)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39665939">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39665939</a> - March 2024 (91 comments)<p><i>(How to Write a (Lisp) Interpreter (In Python)) (2010)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30443949">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30443949</a> - Feb 2022 (9 comments)<p><i>(How to Write a (Lisp) Interpreter (In Python))</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30327437">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30327437</a> - Feb 2022 (3 comments)<p><i>(How to Write a (Lisp) Interpreter (In Python))</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26036431">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26036431</a> - Feb 2021 (1 comment)<p><i>How to Write a Lisp Interpreter In Python (2010)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20590439">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20590439</a> - Aug 2019 (29 comments)<p><i>How to Write a Lisp Interpreter in Python (2010)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12777852">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12777852</a> - Oct 2016 (28 comments)<p><i>How to Write a Lisp Interpreter in Python (2010)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7825054">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7825054</a> - May 2014 (41 comments)<p><i>(How to Write a ((Better) Lisp) Interpreter (in Python))</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1746916">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1746916</a> - Oct 2010 (10 comments)<p><i>(How to Write a (Lisp) Interpreter (in Python))</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1745322">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1745322</a> - Sept 2010 (39 comments)
    • azhenley3 hours ago
      I want to see Dang’s list of fav classics :)
      • fragmede3 hours ago
        Sadly, <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;favorites?id=dang">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;favorites?id=dang</a> is underutilized.
        • dang14 minutes ago
          Yikes, I just learned from looking there that misclick favorites are a thing. Hastily un-favorited some nasty stuff.<p>It would be fun to build up a list of real favorites - just the sort of thing there never seems to be time for...
    • Izmaki5 hours ago
      I feel like we need a vibe coded guide in this modern day and age.
  • jll2943 minutes ago
    Strangely, Peter&#x27;s 1987 Ph.D. thesis cites itself (reference 90), but with the year being off by one (1986).<p>Writing a LISP in Python is only for educational use, or to have a boostrap LISP that you can write a better (faster) LISP in.
  • chombier8 hours ago
    If you ever wondered how to write a programming language, this is probably the best resource to get started (and then of course Crafting Interpreters).<p>See also part 2 <a href="https:&#x2F;&#x2F;norvig.com&#x2F;lispy2.html" rel="nofollow">https:&#x2F;&#x2F;norvig.com&#x2F;lispy2.html</a>
    • embedding-shape5 hours ago
      I&#x27;ve always found MAL (&quot;Make-A-Lisp&quot; <a href="https:&#x2F;&#x2F;github.com&#x2F;kanaka&#x2F;mal" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kanaka&#x2F;mal</a>) a bit more approachable, probably because I was out after creating my own programming language before I&#x27;ve written much Python. It&#x27;s language agnostic, and really easy to follow along with most programming languages out there, explaining everything as you progress.<p>That it&#x27;s language agnostic and somehow matters feels weird now a lot of time (and experience I suppose) afterwards, but back when I only knew 1-2 languages by heart, also having to face understanding Python at the same time from Norvigs guide&#x2F;reference made it slightly more complicated for me.<p>I use this as a litmus test now when coming across new languages (implementing MAL in the new language), as it&#x27;s such an easy approach to practically test large parts of the new language, and there is always host-language-specific tricks you can learn along the way.
  • leonardool4 hours ago
    I&#x27;ve been working on a similar (ish) project for a while: Ribbit (<a href="https:&#x2F;&#x2F;github.com&#x2F;udem-dlteam&#x2F;ribbit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;udem-dlteam&#x2F;ribbit</a>). Supports a full R4RS REPL (with tail-calls) in the same sizes as Lispy (8Kb for JavaScript and 6.5Kb for x86)!
  • zahlman9 hours ago
    (how-to in-python (write (interpreter lisp)))
    • consumer4518 hours ago
      Yes, but to be fair, you only have a couple minutes to fight the HN title regex.
  • wmedrano1 hour ago
    I made a rusty version of this. No linked lists, but that&#x27;s not important in the grand Scheme of things.<p><a href="https:&#x2F;&#x2F;wmedrano.dev&#x2F;post&#x2F;2025&#x2F;11&#x2F;15&#x2F;lisp-1" rel="nofollow">https:&#x2F;&#x2F;wmedrano.dev&#x2F;post&#x2F;2025&#x2F;11&#x2F;15&#x2F;lisp-1</a>
  • userbinator4 hours ago
    And in the other direction, here&#x27;s a Python interpreter written in Lisp: <a href="https:&#x2F;&#x2F;github.com&#x2F;metawilm&#x2F;cl-python" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;metawilm&#x2F;cl-python</a>
    • vindarel3 hours ago
      also in the interop topic:<p>Common Lisp for Python: <a href="https:&#x2F;&#x2F;github.com&#x2F;marcoheisig&#x2F;cl4py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;marcoheisig&#x2F;cl4py</a><p>call Python from CL: <a href="https:&#x2F;&#x2F;github.com&#x2F;digikar99&#x2F;py4cl2-cffi" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;digikar99&#x2F;py4cl2-cffi</a>
    • ginko3 hours ago
      Probably way faster as well.
  • timonoko5 hours ago
    My Lisp from 1975 was actually used in real world and highly lucrative. Gemini could read the source code, but it told that my code was piece of shit and cannot be implemented in 64-bit world without drastic changes, so it made an example. But that version was just too advanced and too complex as a study subject. There are already enuff good Lisps in the world, methinks.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;timonoko&#x2F;nokolisp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;timonoko&#x2F;nokolisp</a>
  • azhenley8 hours ago
    Writing a Lisp is one of my favorite projects. I try to do it every year or two, taking a different approach each time.
    • onraglanroad8 hours ago
      The one where you replaced parentheses with the crying laughing emojis was definitely the worst.
      • all21 hour ago
        This sounds amazing.
  • adamddev14 hours ago
    Interestingly enough, linguists also use Lisp-like parentheses or brackets to annotate sentence structures. Trees and brackets are isomorphic, as both phrase structure grammarians and the original SICP lectures pointed out.<p>The brackets in the title sentence would look a lot different though. ;-)
  • tosh9 hours ago
    I can&#x27;t recommend highly enough to implement a simple lisp (or a forth).<p>Illuminating experience and it will also help you see (among many other things) the parentheses in a different light.
    • stdatomic8 hours ago
      First day of paradigms course in the 2000s and prof says &quot;if your opinion of Scheme is too many parentheses, then you&#x27;re an idiot.&quot;<p>Needless to say that was my opinion and every day I think, more and more, how right he was.<p>(later I did make some gui apps that included scripting and chose s-expr syntax because of how simple it is to implement it)
      • bananaflag8 hours ago
        There are two problems with Lisp parentheses in my opinion:<p>1) Humans are not that equipped to handle that level of nesting without some other aid, this is why Lisp code is usually indented.<p>2) Parentheses aren&#x27;t just about grouping, and this is unintuitive. For example, x is not the same as (x). This is a bit like in set theory where x is not the same as {x}, but parentheses do not look like the kind of sign that would work like that.
        • wmedrano21 minutes ago
          I thought parentheses were fairly intuitive. They are not for grouping, more like representing an AST.<p>For other languages, similarly, x is not the same as x()
        • jimmypk7 hours ago
          @bananaflag, the x versus (x) distinction is also what makes this evaluator so small: the AST uses atom versus list as the dispatch boundary, so grouping and application deliberately share syntax. An infix parser moves that complexity into precedence and associativity rules; it does not eliminate it. Indentation is still essential, but that is a tooling and display issue rather than a grammar issue.
      • NooneAtAll38 hours ago
        main problem isn&#x27;t brackets themselves - it&#x27;s that they&#x27;re too on the right<p>had brackets been displayed as curly braces in C - everything would look much more manageable
        • shakna53 minutes ago
          I actually find wisp [0] harder to read&#x2F;write than just plain Scheme.<p>But there&#x27;s quite a few little reader projects that swap out the first layer of syntax for another. Lisp isn&#x27;t entirely tied to one representation.<p>[0] <a href="https:&#x2F;&#x2F;www.draketo.de&#x2F;software&#x2F;wisp" rel="nofollow">https:&#x2F;&#x2F;www.draketo.de&#x2F;software&#x2F;wisp</a>
        • eska8 hours ago
          I changed my opinion about parens when I stopped formatting like C, and used indent rather than parens to denote blocks. That is, a large amount of them at the end is totally fine.
        • phpnode8 hours ago
          so, instead of<p><pre><code> (foo (bar (1 2 3)) </code></pre> you&#x27;d prefer<p><pre><code> { foo { bar { 1 2 3 } } } </code></pre> is that right?
          • NooneAtAll36 hours ago
            <p><pre><code> ( aar (bar1 1 2 3) (bar2 1 2 3) (bar3 (car1 2 3) (car2) (car3) ) ) </code></pre> vs<p>(aar (bar1 1 2 3) (bar2 1 2 3) (bar3 (car1 2 3)(car2)(car3)))
          • irishcoffee8 hours ago
            Emacs vs vim, go!
  • sashank_15094 hours ago
    Depressing to think that AI will be doing most of this in the future. Sharing it freely in the internet, basically ensures AI can copy it well.
  • timonoko6 hours ago
    I actually perfected the Norvig Lisp at one time. It has compiler to python and just everything. Those <i>very few</i> here that can actually read code, understand why this project soon exploded into biggest piece of odorous excrement.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;timonoko&#x2F;nokolis.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;timonoko&#x2F;nokolis.py</a>
  • librasteve8 hours ago
    or you could just use Raku and its “surprisingly good lisp impression”:<p><a href="https:&#x2F;&#x2F;www.codesections.com&#x2F;blog&#x2F;raku-lisp-impression&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.codesections.com&#x2F;blog&#x2F;raku-lisp-impression&#x2F;</a>
  • mathnode1 hour ago
    ;;;; Not sorry<p>)
  • ljcoco3 hours ago
    article to follow between all the ai noises these days
  • urcite_ty_kokos9 hours ago
    Appreciated the title xD
  • joshuamorton8 hours ago
    There are edge cases where this fails, but `def parse(s): return json.loads(&#x27;[&#x27;+re.sub(&#x27;([&quot;)])\s*([&quot;(])&#x27;,&#x27;\g&lt;1&gt;,\g&lt;2&gt;&#x27;,re.sub(&#x27;[^()\s]+&#x27;,&#x27;&quot;\g&lt;0&gt;&quot;&#x27;,s)).replace(&#x27;(&#x27;,&#x27;[&#x27;).replace(&#x27;)&#x27;,&#x27;]&#x27;)+&#x27;]&#x27;)` is a surprisingly robust lisp parser.
  • e12e9 hours ago
    (2010)?
  • unfirehose3 hours ago
    [flagged]
  • timonoko8 hours ago
    [flagged]
    • genxy7 hours ago
      There is always someone better than you at almost everything you do, this is statistical reality.<p>If all you care about is the artifact and not the path, there is no reason to do anything.<p>Use the tool to better yourself, your understanding and push the limits of what is possible. If a Lisp in assembly with GC is now hello world, change what a hard project is.<p>I see this attitude a lot, and I think it is rooted in a sort of self-centered elitism. Anyone can do it, so why do it? Instead you could have the AI teach you how to implement it yourself with a deep understanding that no human, even if you paid them, would put up with.<p>But sure, get depressed. But why tho?
      • matheusmoreira1 hour ago
        &gt; I see this attitude a lot, and I think it is rooted in a sort of self-centered elitism. Anyone can do it, so why do it?<p>The undercurrent is that nobody will be able to make a career out of it anymore. Sure, programming is intellectually stimulating, but it&#x27;s questionable whether it&#x27;ll lead to highly compensated jobs now.<p>I&#x27;m a hobbyist who loves computers so I&#x27;m still going to do it. I have been entertaining thoughts of doing it professionally though. The market isn&#x27;t encouraging at all.
    • tosh7 hours ago
      is learning how to accomplish or understand something boring<p>just because someone or something else does it better?
    • abecedarius7 hours ago
      It&#x27;s funny, in the 8-bit days a lot of us learned programming for its own sake without much expectation it&#x27;d be lucrative. Took ~50 years to get back to that spirit as the default.
    • Lyngbakr7 hours ago
      It depends <i>why</i> you&#x27;re doing it. Are you doing it for the product or the process? (Of course, they&#x27;re not mutually exclusive.) I do it for the fun of building, in which case AI is irrelevant.
    • chamomeal8 hours ago
      I mean it’s still worth doing, even if AI can do it. But I definitely empathize with that bit of AI ennui.
  • timonoko6 hours ago
    ?
    • Jtsummers6 hours ago
      Why did you replace your very similar comment with &quot;--&quot; just to post essentially the same thing again?
  • RedCinnabar7 hours ago
    Man these kind of resources have aged really bad in the age of AI.
    • Crespyl7 hours ago
      Why would AI make these age worse than, say, libraries or languages becoming obsolete?<p>I don&#x27;t think a good learning resource gets worse just because there&#x27;s a newer alternative.
      • RedCinnabar7 hours ago
        &gt; I don’t think a good learning resource gets worse[...]<p>Probably not, but they become irrelevant. The other day I found an old programming book at my parents’ and while it was still a terrific resource, I couldn’t image anyone learning a language from a book nowadays.<p>AI is doing the same thing but 100 times effectively than anything else.
    • incanus777 hours ago
      How do you mean “these kind”?
      • RedCinnabar7 hours ago
        Blog tutorials, guides, programming books and youtube tutorials. They are completely irrelevant in a time where you have a personal tutor willing to explain every single detail of a subject.
        • matheusmoreira52 minutes ago
          Relevance is overrated. I&#x27;ve been writing for myself. Writing articles about the implementation of my programming language helps crystallize my knowledge. It&#x27;s been remarkably effective at ensuring I won&#x27;t simply forget the subject matter in the future. The fact other humans might enjoy reading my articles is just a nice bonus.
        • macintux6 hours ago
          That&#x27;s like saying your grandfather is irrelevant now that he&#x27;s spawned children and grandchildren. Good luck to those personal tutors without this source material.
    • jgalt2127 hours ago
      How so?