Oh cool, someone else besides me posted my blog :D I'm the author and here to answer questions and take constructive criticism. If you want to comment but don't have an HN account, please check out the mailing list: https://lists.sr.ht/~max/compiling-lisp
Compiling a Lisp: Reader
21–30 of 30 posts
Re: Compiling a Lisp: Reader
#22Oh cool, someone else besides me posted my blog :D I'm the author and here to answer questions and take constructive criticism. If you want to comment but don't have an HN account, please check out the mailing list: https://lists.sr.ht/~max/compiling-lisp
Is there a reason you treat the arithmetic operators specially in your reader? Non-lisps do so as they are infix operators, but most lisps treat them the same as any other identifier.
Re: Compiling a Lisp: Reader
#23For a very simple, very readable Lisp reader, see Lumen's reader.l file: https://github.com/sctb/lumen/blob/master/reader.l It compiles to Javacript and Lua, so if you prefer reading those, you can: https://github.com/sctb/lumen/blob/master/bin/reader.js https://github.com/sctb/lumen/blob/master/bin/reader.lua It turns out that you can greatly simplify the code by e.g. "does an atom start with 0x, 0-9, or dash? if so…
Why are atoms that start with numbers accepted as symbols? Is there any usecase for that?
Re: Compiling a Lisp: Reader
#24Earlier quoted context omitted.
Why are atoms that start with numbers accepted as symbols? Is there any usecase for that?
The use case is someone wanted to name a symbol that way. What’s wrong with that?
Re: Compiling a Lisp: Reader
#25Earlier quoted context omitted.
Why are atoms that start with numbers accepted as symbols? Is there any usecase for that?
Lots of things you might want to name have natural names starting with numbers. If you're writing, say, a TSP solver, some of your procedures may be called 2-opt or 3-opt, for example.
Re: Compiling a Lisp: Reader
#26Earlier quoted context omitted.
Is there a reason you treat the arithmetic operators specially in your reader? Non-lisps do so as they are infix operators, but most lisps treat them the same as any other identifier.
I don't think I treat them any differently in my reader. They are part of the set of "symbol characters". I do special case + and - prefixed integers, though.
Re: Compiling a Lisp: Reader
#27Earlier quoted context omitted.
The use case is someone wanted to name a symbol that way. What’s wrong with that?
Nothing wrong, was just wondering in case I missed something, in most languages by convention variables and functions cannot start with a number. I'm learning lisp and ran into this at some point just had the chance to ask someone experienced why.
Re: Compiling a Lisp: Reader
#28I've been working my way through Beautiful Racket [1] over the last week or so. It's been awesome. If this kind of thing is of interest to you, I highly recommend it. It's a book focused on a way of thinking that involves building small domain-specific languages to solve your problems. It's so easy. Racket (if you're not aware of what it is) is just a lisp, but the standard library includes an incredible amount of su…
Re: Compiling a Lisp: Reader
#29Earlier quoted context omitted.
The use case is someone wanted to name a symbol that way. What’s wrong with that?
Nothing wrong, was just wondering in case I missed something, in most languages by convention variables and functions cannot start with a number. I'm learning lisp and ran into this at some point just had the chance to ask someone experienced why.
Re: Compiling a Lisp: Reader
#30Earlier quoted context omitted.
I love seeing long form blog posts like this! Whilst its not something I’d personally do for a long time, its great to have resources on the web that go into detail in advanced topics like building a lisp interpreter. From another lisper, congrats and well done!
I agree that I really enjoy reading in-depth blog post series, but after releasing a 3-part series myself, I'm not sure if I would do it again. Each subsequent post got about 1/3 the views of the previous one, and wow does it take sooo much more effort to write than a one-off post! This one is great though. I just every few days for the next post!
Unfortunately the internet has moved towards short form, rehashing simple concepts and clickbait titles - there’s so much junk online, and the signal to noise ratio is high.
But people are gaming for most interaction, views, etc and attention spans are shorter. So this is the world we live in