[HN Gopher] Adventures in REPL Implementation
___________________________________________________________________
Adventures in REPL Implementation
Author : rcarmo
Score : 74 points
Date : 2023-03-10 08:24 UTC (14 hours ago)
(HTM) web link (tonsky.me)
(TXT) w3m dump (tonsky.me)
| erichocean wrote:
| Seems like building off of a Lezer grammar for Clojure would have
| been the way to go. It's lightweight, fast, and supports very
| fast incremental re-parsing. [0]
|
| If anyone wants a fun project, adding Parinfer [1] support to
| lang-clojure [2] for CodeMirror 6 would be welcome.
|
| [0] https://github.com/nextjournal/lezer-clojure
|
| [1] https://shaunlebron.github.io/parinfer/
|
| [2] https://github.com/nextjournal/lang-clojure
| goldfeld wrote:
| Having just this week gone through reviewing (with AI etc) an old
| vim plugin of mine[1] that tries to add worthwhile features to an
| editor, that is, vim, and knowing tonsky's Clojure work for a
| long time (formerly possibly having featured him, don't remember
| the details, on a '14 clojure open source newsletter I used to
| run, the one linked below being a spiritual successor to that
| one), I have the deepest respect for him and open source authors
| greatly improving the dev experience for everyone else,
| especially on Emacs and vim, but before learning vim I used to
| use Sublime and I gotta say I miss the sleek factor, and this
| post actually made me want to use that again along with this repl
| impl to get some Clojure hacking done again, after so long away
| from it. Clojure is a real blessing, I wonder it has really
| fallen so much out of favor since the heyday in 2014, maybe to
| Elixir, can anyone comment?
|
| [1]: https://generativereview.substack.com/p/chatgpt-review-my-
| co...
| frou_dh wrote:
| Sublime Text actually has more than one high-quality option for
| interactive Clojure development. Here's the other one:
| https://tutkain.flowthing.me/
| goldfeld wrote:
| Awesome, thank you! such a pity the Lighttable dream dried up
| and died.
| Joker_vD wrote:
| > So yeah, I guess no beautiful theory on error recovery.
|
| People tried, believe me: back when running compilers as batch
| jobs i.e. non-interactively was the norm, it was expected for
| them to find as many syntax errors as possible in one go, so the
| programmer could fix as much of his program as possible before
| resubmitting it.
|
| But yes, simple "when parsing list of X, skip until you find
| something that looks like the end of X (or start of another
| X/whatever is expected after the list of X) and try to parse
| another X" works surprisingly well, especially in statement-
| oriented (block-oriented?) languages: you can almost always
| reliably detect an end of the block/function or a start of top-
| level declaration and start from that point.
|
| The most difficult to sensibly catch error, in my experience,
| happens inside the _lexer_ : the case of a run-away string. Add a
| random quote mark in the middle of program text and suddenly,
| everything after it produces _completely_ different, mostly
| nonsensical, stream of tokens.
| RicardoLuis0 wrote:
| > the case of a run-away string
|
| that, i'd guess, is one of the reasons why most languages don't
| allow multi-line strings without special syntax
| JHonaker wrote:
| It's definitely why TeX macros are not "\long" (i.e. they
| cannot span more than one paragraph) by default.
| waffletower wrote:
| I really appreciate the author's quest for better Clojure
| tooling. But I don't like their advocacy for "one code format to
| rule them all". Imposing single uniform code formatting standards
| is a common refrain from tidy software engineers -- but it is a
| little too tidy -- and invites criticism. My favorite response
| comes from a Meat Beat Manifesto song,
| https://www.youtube.com/watch?v=1PPuRuKVc6k, where toward the end
| you can clearly hear a relevant sample a few emphatic times:
| "Make them dance the same dance". I tend not to enjoy
| goosestepping myself, and prefer to choose to move in a way that
| feels more natural and personal.
| fishbacon wrote:
| Completely off topic: The dark-mode made me chuckle.
| swah wrote:
| Haha, had forgotten about that.
|
| (OP is talking about the page dark mode, not the code
| examples.)
| LoganDark wrote:
| Oh my god. That's genius.
___________________________________________________________________
(page generated 2023-03-10 23:01 UTC)