Readit News logoReadit News
gorgoiler · 20 days ago
I learned recently that the creator of the Iosevka typeface did so using their own Lisp implementation.

The typeface:

https://github.com/be5invis/Iosevka

The language:

https://github.com/be5invis/PatEL

Their tool which they used to build the language:

https://github.com/be5invis/patrisika

These kinds of projects are deeply inspirational. Striving to achieve one percent of this output would be enough for me. Knowing there are people like Belleve / Renzhi Li and their team in the world -- that I might be able to do something like what they do if I, too, try hard -- is what makes me get out of bed in the morning. It is incredible that there are people like them, doing what they do, and sharing it freely. Thank you so much.

PS: Re: inspo: Hope 16 is next week :D https://www.hope.net/pdf/hope_16_schedule.pdf

metalliqaz · 20 days ago
I poked around on those links and I have yet failed to find any use of this Lisp in that font project. Looks like he just built everything with Javascript
dannyobrien · 20 days ago
The glyphs themselves are written in PatEl: see https://github.com/be5invis/Iosevka/blob/main/packages/font-...

for instance. If you look through the commit history, you can see Be5invis gradually elaborating the font itself by editing these files.

Javascript is used as the build language, but not to define the characters.

cardanome · 20 days ago
Don’t Build Your Own Lisp: https://gist.github.com/no-defun-allowed/7e3e238c959e27d4919...

Just so people are aware of it. It is not a good source if you want to learn how to make a lisp that could scale beyond a toy.

You can still learn a bit of C and get a taster of how to make a language, just be aware that some stuff you learn will hold you back in the long term.

Fraterkes · 20 days ago
I’m sure the author of this is actually a nice person, but this is the first time I’ve actually seen a lisper being smug and obnoxious in the way I’ve seen people satirize a thousand times.
wk_end · 20 days ago
Compared to much of what went on comp.lang.lisp this is pretty gentle. Based on the impression it gives of the book, possibly more gentle than it deserves!
cardanome · 20 days ago
I think the issue is that the topic comes up quite often as seen by the author needing to create the gist. It easy to come across as a bit of "smug and obnoxious" when you explain something for the xth time.

I remember chatting with them years ago and they were pretty friendly. But yeah Lisp does have a specific culture and it can put people off thought I personally never encountered any bad apples.

int_19h · 20 days ago
Well, they are writing about someone who purports to teach people how to implement programming languages, but then botches it rather badly.
KerrAvon · 20 days ago
I don't know, it doesn't seem overly smug to me. It seems borne of experience and helpfulness.

"And a parser generator is very overkill for a Lisp parser - just use recursive decent!" -- it's interesting that, as simple as Lisp is to parse, this is the same advice you'd get from experienced C/C++ compiler writers, from modern Clang to Stroustrup in 1993.

BalinKing · 20 days ago
With the exception of one or two sentences, it sounded pretty neutral to me... maybe I just didn't read it closely enough? The "dogmatism" of the technical criticism (assuming the post is accurate) really does seem justified to me—e.g. if the book uses dynamic scoping without even a disclaimer like "this is a bad idea, but we're doing it for simplicity", that alone makes it a bad recommendation for beginners IMO.
matheusmoreira · 20 days ago
He makes many good points in his criticism but I'm still wondering what language one's supposed to use if not C.

My lisp has a conservative mark-and-sweep garbage collector. The mark phase spills all registers and then walks the entire stack looking for pointers to lisp objects. I managed to implement the stack walking through some convoluted pointer nonsense but even C could not express the notion of spilling registers, I had to write assembly code for each architecture.

I have no idea how such a garbage collector would be implemented in Rust or Zig.

int_19h · 20 days ago
The same exact way you did it in C - by relying on implementation-specific features such as assembly.
kazinator · 20 days ago
>> In our Lisp, when we re-assign a name we’re going to delete the old association and create a new one. This gives the illusion that the thing assigned to that name has changed, and is mutable, but in fact we have deleted the old thing and assigned it a new thing.

> Please don’t do that. What would be the result of evaluating:

  (let ((a 1))
    (+ (let ((a 2)) a) a))
That is off the mark; that example doesn't re-assign anything; it is binding a shadowing instance of a.

Removing a binding and destructively creating a new one in the same environment is a viable strategy for implementing assignment, compared to mutating just the value part while keeping the same binding cell.

You can implement it so that the semantics is absolutely identical; the program simply cannot tell.

If you try to make it nondestructive somehow, then the program can tell; e.g. if you functionally rewrite the current environment to produce a new environment in which the variable is edited to the new value. then closures will reveal the trick. Previously captured closures keep seeing the old environment and old value (obviously inapplicable discussion to dynamic scope).

If a variable that has been captured by any number of closures is destructively assigned, all the closures must see the new value after the assignment, otherwise you have something other than assignment.

Arch-TK · 20 days ago
You shouldn't use it to learn C either. It's full of bad C.
munificent · 20 days ago
Here's a more balanced take:

"Build Your Own Lisp" is an opinionated, idiosyncratic take on one style of programming in C and one way to implement a Lisp-like language.

If you go into it treating it like an intro textbook to the "standard" way of implementing an interpreter, it may lead you astray. Worse, it may lead you astray without realizing it if it's your first book on the topic.

On the other hand, if you approach it as following an author as they deliberately wander off the well-trod path of implementing Lisps with recursive descent and all the other classic techniques, then you can have a good time and maybe get some interesting ideas out of it.

For what it's worth, I quite enjoyed the book. But I had enough programming language experience already to know when the author was teaching you the basics versus teaching you their own thing.

The more the world world becomes aggregated, summarized, averaged, and watered down, the more I crave stuff like this that is quirky and unique.

fud101 · 20 days ago
This is a solid take. I also had the same opinion on the book. You're better off doing the Norvig Lisp in Python journey then branching out on your own.
freilanzer · 20 days ago
That sounds horrible. What are better resources?
stevekemp · 20 days ago
MAL, the original "make a lisp", is a bit terse on details but gives you freedom to use different languages, and yet still provide a rough blueprint:

https://github.com/kanaka/mal

Discussed here, a few times:

https://news.ycombinator.com/from?site=github.com/kanaka

cardanome · 20 days ago
MAL is pretty good, albeit less hand-holding: https://github.com/kanaka/mal

Writing a Lisp in Ocaml: https://bernsteinbear.com/blog/lisp/00_fundamentals/

Not Lisp-specific but Crafting Interpreters is also great: https://craftinginterpreters.com/

hajile · 20 days ago
I'd say that the best is probably the book "Lisp in Small Pieces".

Be aware that it's some 500 pages and makes several interpreters then a couple of compilers as I recall. If you read it though, you'll come out the other end with a pretty good understanding of how lisp implementations actually work.

axblount · 20 days ago
Lisp In Small Pieces by Christian Queinnec

It takes a very thoughtful approach to introducing an increasingly complex Scheme implementation. I doesn't shy away from the complexity that many LISP implementation tutorials try to push under the rug.

teunispeters · 20 days ago
I started from https://github.com/videogamepreservation/abuse which ... well, isn't perfect but it IS fun and the original game was, too.
OhMeadhbh · 20 days ago
I just nano-blogged my thoughts about this yesterday: https://BI6.US/CO/N/20250803.HTML#/080401
lskfiep · 21 days ago
This is MUCH more than a 'Build Your Own Lisp'. To the point of almost being anything but.

This is an amazing resource for getting started with learning C by making your own "programming language", independent of any Lisp conventions.

For me, the most 'lispy' aspect of 'making your own lisp' is prebaked by the author with their using their own prebuilt parser library 'mpc'. (I was unable to find a link to the source in the book, so https://github.com/orangeduck/mpc )

I was unable to find any instance of 'car' or 'cdr' or 'caddar' and their like, which I feel is the real 'build your own lisp' epiphany.

https://en.wikipedia.org/wiki/CAR_and_CDR

The parser is so widely, and wildly, useful that it is independent of notation style, for instance, lisp's nearly ubiquitous 'polish notation'. (or its variants, for instance, 'cambridge polish notation')

Perfect example:

Under 'Chapter 9: Reading Expressions':

> Don't Lisps use Cons cells?

> Other Lisps have a slightly different definition of what an S-Expression is. In most other Lisps S-Expressions are defined inductively as either an atom such as a symbol of number, or two other S-Expressions joined, or cons, together.

> This naturally leads to an implementation using linked lists, a different data structure to the one we are using. I choose to represent S-Expressions as a variable sized array in this book for the purposes of simplicity, but it is important to be aware that the official definition, and typical implementation are both subtly different.

https://www.buildyourownlisp.com/chapter9_s_expressions#Read...

This is an awesome educational resource.

I think I would promote it more broadly than "Build Your Own Lisp".

netbioserror · 21 days ago
Unfortunately, part of the pragmatic usefulness of newer Lisps (Clojure and Janet) is the abandonment of CAR and CDR in favor of efficient distinct data structure types backed by efficient bases (tries, arrays, arraylists, hashmaps) and a focus on homoiconicity as the winning feature, separated forcefully from the idea of linked lists and CAR/CDR.
munificent · 20 days ago
I'm honestly not sure why this sentence starts with "unfortunately".

Linked lists are comically inefficient on modern hardware and naming two of your fundamental operations based on CPU instructions from a chip from the 60s is not what I would call good API design.

kentrado · 20 days ago
I don't well understand this. How is clojure more efficient than common lisp?

Would you explain further?

rscho · 20 days ago
> efficient distinct data structure types backed by efficient bases

...do not require abandoning CAR and CDR, I think. See all other lisps having vectors, hashmaps, etc. Perhaps you're talking for code representation ? But I don't think that true for all 'traditional' lisps either. Also, there's been some innovation regarding lists: https://docs.racket-lang.org/reference/treelist.html

staplung · 20 days ago
As others have pointed out, this is as much about learning C as it is about making a Lisp.

If you're interested in the latter, Peter Norvig has a little project that builds a stripped down Scheme interpreter in python. Takes some shortcuts, provides only a few functions (about 30) to its environment and only recognizes 5 special forms (`quote`, `if`, `define`, `set!`, and `lambda`) but the whole thing is less than 150 lines and very informative if you're new to that kind of thing.

https://norvig.com/lispy.html

atan2 · 20 days ago
The iso-9899.info C language website also includes this book in their "Stuff That Should Be Avoided" section.

https://www.iso-9899.info/wiki/Books#Stuff_that_should_be_av...

J_McQuade · 20 days ago
I feel called out - I have read and learned from 4 of the things on that list.

I am also really bad at C, though, so "Can confirm", I guess?

fmbb · 20 days ago
That page also seems to recommend using lex and yacc, so … what are we to do with this information?
shawn_w · 20 days ago
Nothing wrong with lex and yacc.
burnt-resistor · 20 days ago
I concur with Stuff That Should Be Avoided.
carraes · 20 days ago
Huh? It doesn't

Edit: nvm, found it on the bigger list

Dead Comment

dang · 20 days ago
Related:

Build Your Own Lisp - https://news.ycombinator.com/item?id=36103946 - May 2023 (12 comments)

Learn C and build your own Lisp (2014) - https://news.ycombinator.com/item?id=35726033 - April 2023 (45 comments)

Learn C and build your own Lisp (2014) - https://news.ycombinator.com/item?id=27598424 - June 2021 (86 comments)

Learn C and Build Your Own Lisp (2014) - https://news.ycombinator.com/item?id=17478489 - July 2018 (86 comments)

Learn C and build your own Lisp - https://news.ycombinator.com/item?id=10474717 - Oct 2015 (49 comments)

Learn C and build your own Lisp - https://news.ycombinator.com/item?id=7530427 - April 2014 (145 comments)

tnlogy · 20 days ago
Someone seems to have saved my old self-compiling scheme-to-c compiler in about 1k lines of scheme code. https://github.com/veqqq/llvm_scheme/blob/main/compile.ccode... (also an llvm version)

Maybe I should read and compare it. Mine was a really slow Poc to inspired by SICP, is that book still used in courses somewhere?

potato-peeler · 19 days ago
It seems to use c99, I would like to know from folks who have read this book, for learning newer features in C, what do you recommend?

Also, does this book also teach some of the pitfalls of stdlib like gets or scanf?

Basically I always read in HN/lobsters/other forums that modern C is just as safe as newer languages but I don’t see much book or tutorials teaching modern concepts or even industry standards like Misra?

atiedebee · 19 days ago
> Basically I always read in HN/lobsters/other forums that modern C is just as safe as newer languages

This is absolutely false. Modern C++ might get close (although I am not too familiar with it) but C has not gotten much safer over the years (one might argue it got even less safe due to threads being added in C11).

As for learning about modern versions of C: you can read cppreference[0] which has fairly accurate information on the standard. Not much has been added over the years and C17 is merely a minor correction, so there has really only been 2 new versions since C99.

[0]: https://en.cppreference.com/w/c.html

potato-peeler · 19 days ago
I specifically mentioned Misra standards for writing safe C. And ensuring thread safety is not just a C Lang pitfall.

I was not looking for language reference rather how current software written in C ensure memory safety. How do their development paradigm look like?

Teaching both the software pitfalls in C and how to mitigate them, maybe by giving examples from modern software or standards like Misra, will really help someone to understand how to write better C. Just linking a language reference does not help.