I feel like we need a vibe coded guide in this modern day and age.
23 hours ago [-]
chombier 1 days 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).
I've always found MAL ("Make-A-Lisp" https://github.com/kanaka/mal) a bit more approachable, probably because I was out after creating my own programming language before I've written much Python. It's language agnostic, and really easy to follow along with most programming languages out there, explaining everything as you progress.
That it'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/reference made it slightly more complicated for me.
I use this as a litmus test now when coming across new languages (implementing MAL in the new language), as it'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.
leontrolski 17 hours ago [-]
Similarly - 80 line LISP interpreter with integers, lexical scope, first class functions
Yes, but to be fair, you only have a couple minutes to fight the HN title regex.
leonardool 1 days ago [-]
I've been working on a similar (ish) project for a while: Ribbit (https://github.com/udem-dlteam/ribbit). Supports a full R4RS REPL (with tail-calls) in the same sizes as Lispy (8Kb for JavaScript and 6.5Kb for x86)!
okaleniuk 16 hours ago [-]
Classics!
There is a different take on Lisp in Python - fakelisp. It's literally Lisp in Python, not an interpreter, but a syntax sugar library that allows embedding Lisp snippets into valid Python.
from fakelisp import *
# And now you can start mixing Python and LISP
X = (BEGIN
(SET (F) (LAMBDA (X)
(IF (EQ (X) (1))
(1)
(MUL (X) (F (SUB (X) (1)))))))
(LIST (F (4)) (42)))
# Back to Python any time
print "x: ", str(X)
I can't recommend highly enough to implement a simple lisp (or a forth).
Illuminating experience and it will also help you see (among many other things) the parentheses in a different light.
stdatomic 1 days ago [-]
First day of paradigms course in the 2000s and prof says "if your opinion of Scheme is too many parentheses, then you're an idiot."
Needless to say that was my opinion and every day I think, more and more, how right he was.
(later I did make some gui apps that included scripting and chose s-expr syntax because of how simple it is to implement it)
bananaflag 1 days ago [-]
There are two problems with Lisp parentheses in my opinion:
1) Humans are not that equipped to handle that level of nesting without some other aid, this is why Lisp code is usually indented.
2) Parentheses aren'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.
wmedrano 22 hours ago [-]
I thought parentheses were fairly intuitive. They are not for grouping, more like representing an AST.
For other languages, similarly, x is not the same as x()
jimmypk 1 days 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.
NooneAtAll3 1 days ago [-]
main problem isn't brackets themselves - it's that they're too on the right
had brackets been displayed as curly braces in C - everything would look much more manageable
eska 1 days 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.
shakna 23 hours ago [-]
I actually find wisp [0] harder to read/write than just plain Scheme.
But there's quite a few little reader projects that swap out the first layer of syntax for another. Lisp isn't entirely tied to one representation.
Writing a Lisp is one of my favorite projects. I try to do it every year or two, taking a different approach each time.
onraglanroad 1 days ago [-]
The one where you replaced parentheses with the crying laughing emojis was definitely the worst.
all2 24 hours ago [-]
This sounds amazing.
onraglanroad 5 hours ago [-]
I enjoyed thinking about it. Maybe replace if...else with great...sad etc
jll29 23 hours ago [-]
Strangely, Peter's 1987 Ph.D. thesis cites itself (reference 90), but with the year being off by one (1986).
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.
timonoko 1 days 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.
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.
The brackets in the title sentence would look a lot different though. ;-)
avilay 16 hours ago [-]
I'll put in a plug for David Beazly's SICP course. While we didn't build a full Lisp interpreter, we built something similar over a week-long hands-on course. I believe his github for the course is private and only available to students. https://www.dabeaz.com/sicp.html
sashank_1509 1 days 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.
timonoko 1 days ago [-]
I actually perfected the Norvig Lisp at one time. It has compiler to python and just everything. Those very few here that can actually read code, understand why this project soon exploded into biggest piece of odorous excrement.
article to follow between all the ai noises these days
urcite_ty_kokos 1 days ago [-]
Appreciated the title xD
mathnode 23 hours ago [-]
;;;; Not sorry
)
joshuamorton 1 days ago [-]
There are edge cases where this fails, but `def parse(s): return json.loads('['+re.sub('([")])\s*(["(])','\g<1>,\g<2>',re.sub('[^()\s]+','"\g<0>"',s)).replace('(','[').replace(')',']')+']')` is a surprisingly robust lisp parser.
unfirehose 1 days ago [-]
[flagged]
1 days ago [-]
timonoko 1 days ago [-]
[flagged]
genxy 1 days ago [-]
There is always someone better than you at almost everything you do, this is statistical reality.
If all you care about is the artifact and not the path, there is no reason to do anything.
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.
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.
But sure, get depressed. But why tho?
matheusmoreira 23 hours ago [-]
> 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?
The undercurrent is that nobody will be able to make a career out of it anymore. Sure, programming is intellectually stimulating, but it's questionable whether it'll lead to highly compensated jobs now.
I'm a hobbyist who loves computers so I'm still going to do it. I have been entertaining thoughts of doing it professionally though. The market isn't encouraging at all.
genxy 15 hours ago [-]
It changes what you can do and how you do it, but it still needs someone with skills to drive it.
And it does hit a capability plateau, you cannot just say, "make me a compiler for xyz". Your prompt has to be at least 8 sentences. A skilled programmer and a skilled user of AI can do amazing things. But you need to be both. Lay persons cranking out zombie react sites shouldn't be scaring anyone. It is good to have a half functioning prototype, it allows everyone to have something to bounce ideas off of.
1 days ago [-]
tosh 1 days ago [-]
is learning how to accomplish or understand something boring
just because someone or something else does it better?
abecedarius 1 days ago [-]
It's funny, in the 8-bit days a lot of us learned programming for its own sake without much expectation it'd be lucrative. Took ~50 years to get back to that spirit as the default.
Lyngbakr 1 days ago [-]
It depends why you're doing it. Are you doing it for the product or the process? (Of course, they're not mutually exclusive.) I do it for the fun of building, in which case AI is irrelevant.
chamomeal 1 days ago [-]
I mean it’s still worth doing, even if AI can do it. But I definitely empathize with that bit of AI ennui.
timonoko 1 days ago [-]
?
Jtsummers 1 days ago [-]
Why did you replace your very similar comment with "--" just to post essentially the same thing again?
1 days ago [-]
1 days ago [-]
1 days ago [-]
RedCinnabar 1 days ago [-]
Man these kind of resources have aged really bad in the age of AI.
Crespyl 1 days ago [-]
Why would AI make these age worse than, say, libraries or languages becoming obsolete?
I don't think a good learning resource gets worse just because there's a newer alternative.
RedCinnabar 1 days ago [-]
> I don’t think a good learning resource gets worse[...]
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.
AI is doing the same thing but 100 times effectively than anything else.
incanus77 1 days ago [-]
How do you mean “these kind”?
RedCinnabar 1 days 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.
matheusmoreira 23 hours ago [-]
Relevance is overrated. I've been writing for myself. Writing articles about the implementation of my programming language helps crystallize my knowledge. It's been remarkably effective at ensuring I won't simply forget the subject matter in the future. The fact other humans might enjoy reading my articles is just a nice bonus.
macintux 1 days ago [-]
That's like saying your grandfather is irrelevant now that he's spawned children and grandchildren. Good luck to those personal tutors without this source material.
Related:
(How to Write a (Lisp) Interpreter (In Python)) (2010) - https://news.ycombinator.com/item?id=39665939 - March 2024 (91 comments)
(How to Write a (Lisp) Interpreter (In Python)) (2010) - https://news.ycombinator.com/item?id=30443949 - Feb 2022 (9 comments)
(How to Write a (Lisp) Interpreter (In Python)) - https://news.ycombinator.com/item?id=30327437 - Feb 2022 (3 comments)
(How to Write a (Lisp) Interpreter (In Python)) - https://news.ycombinator.com/item?id=26036431 - Feb 2021 (1 comment)
How to Write a Lisp Interpreter In Python (2010) - https://news.ycombinator.com/item?id=20590439 - Aug 2019 (29 comments)
How to Write a Lisp Interpreter in Python (2010) - https://news.ycombinator.com/item?id=12777852 - Oct 2016 (28 comments)
How to Write a Lisp Interpreter in Python (2010) - https://news.ycombinator.com/item?id=7825054 - May 2014 (41 comments)
(How to Write a ((Better) Lisp) Interpreter (in Python)) - https://news.ycombinator.com/item?id=1746916 - Oct 2010 (10 comments)
(How to Write a (Lisp) Interpreter (in Python)) - https://news.ycombinator.com/item?id=1745322 - Sept 2010 (39 comments)
It would be fun to build up a list of real favorites - just the sort of thing there never seems to be time for...
See also part 2 https://norvig.com/lispy2.html
That it'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/reference made it slightly more complicated for me.
I use this as a litmus test now when coming across new languages (implementing MAL in the new language), as it'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.
https://leontrolski.github.io/interpreter.html
There is a different take on Lisp in Python - fakelisp. It's literally Lisp in Python, not an interpreter, but a syntax sugar library that allows embedding Lisp snippets into valid Python.
https://codeberg.org/okaleniuk/fakelisp
Common Lisp for Python: https://github.com/marcoheisig/cl4py
call Python from CL: https://github.com/digikar99/py4cl2-cffi
Illuminating experience and it will also help you see (among many other things) the parentheses in a different light.
Needless to say that was my opinion and every day I think, more and more, how right he was.
(later I did make some gui apps that included scripting and chose s-expr syntax because of how simple it is to implement it)
1) Humans are not that equipped to handle that level of nesting without some other aid, this is why Lisp code is usually indented.
2) Parentheses aren'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.
For other languages, similarly, x is not the same as x()
had brackets been displayed as curly braces in C - everything would look much more manageable
But there's quite a few little reader projects that swap out the first layer of syntax for another. Lisp isn't entirely tied to one representation.
[0] https://www.draketo.de/software/wisp
(aar (bar1 1 2 3) (bar2 1 2 3) (bar3 (car1 2 3)(car2)(car3)))
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.
https://github.com/timonoko/nokolisp
https://wmedrano.dev/post/2025/11/15/lisp-1
The brackets in the title sentence would look a lot different though. ;-)
https://github.com/timonoko/nokolis.py
https://www.codesections.com/blog/raku-lisp-impression/
)
If all you care about is the artifact and not the path, there is no reason to do anything.
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.
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.
But sure, get depressed. But why tho?
The undercurrent is that nobody will be able to make a career out of it anymore. Sure, programming is intellectually stimulating, but it's questionable whether it'll lead to highly compensated jobs now.
I'm a hobbyist who loves computers so I'm still going to do it. I have been entertaining thoughts of doing it professionally though. The market isn't encouraging at all.
And it does hit a capability plateau, you cannot just say, "make me a compiler for xyz". Your prompt has to be at least 8 sentences. A skilled programmer and a skilled user of AI can do amazing things. But you need to be both. Lay persons cranking out zombie react sites shouldn't be scaring anyone. It is good to have a half functioning prototype, it allows everyone to have something to bounce ideas off of.
just because someone or something else does it better?
I don't think a good learning resource gets worse just because there's a newer alternative.
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.
AI is doing the same thing but 100 times effectively than anything else.