HN user

xiaq

2,333 karma
Posts47
Comments473
View on HN
www.youtube.com 1y ago

Designing a shell language for the 2010s [video]

xiaq
2pts0
elv.sh 2y ago

Beginner’s Guide to Elvish

xiaq
4pts0
devblogs.microsoft.com 4y ago

TypeScript 4.6

xiaq
2pts0
go.dev 4y ago

Go 1.18 Beta 1 is available, with generics

xiaq
14pts1
www.youtube.com 4y ago

Gerald Jay Sussman keynote, day 2 of re:Clojure conference 2021

xiaq
3pts0
elv.sh 4y ago

Elvish 0.16.0 Release Notes

xiaq
3pts0
lit.dev 5y ago

Lit: Simple Fast Web Components

xiaq
2pts0
about.codecov.io 5y ago

Codecov Bash Uploader compromised

xiaq
198pts77
download.clojure.org 5y ago

A history of Clojure (2020) [pdf]

xiaq
2pts0
elv.sh 5y ago

Quick Tour – Elvish Shell

xiaq
3pts0
racket-news.com 6y ago

Racket News – Issue 29

xiaq
1pts0
www.gnu.org 6y ago

The Kawa Scheme Language

xiaq
3pts0
github.com 6y ago

PubSubHubbub

xiaq
2pts0
elv.sh 7y ago

Elvish Shell

xiaq
1pts0
docs.racket-lang.org 7y ago

Evaluation Model [of Racket]

xiaq
2pts0
www.scheme.com 7y ago

The Scheme Programming Language, 4th Edition

xiaq
2pts0
en.wikipedia.org 7y ago

Atmospheric railway

xiaq
44pts11
elv.sh 7y ago

Elvish 0.12 Release Notes

xiaq
1pts0
tree-sitter.github.io 7y ago

Tree-Sitter, a parser generator tool and an incremental parsing library

xiaq
1pts0
en.wikipedia.org 8y ago

Microsoft vs. MikeRoweSoft

xiaq
1pts0
kakoune.org 8y ago

Kakoune code editor

xiaq
1pts0
elvish.io 8y ago

Elvish 0.11 released

xiaq
1pts1
mridgers.github.io 8y ago

Clink: Powerful Bash-style command line editing for cmd.exe

xiaq
2pts0
commandcenter.blogspot.com 8y ago

Error handling in Upspin

xiaq
88pts26
elvish.io 8y ago

Elvish Newsletter, Sep 2017 Issue

xiaq
4pts0
elvish.io 9y ago

Elvish Newsletter, July 2017 Issue

xiaq
2pts0
elvish.io 9y ago

Elvish: friendly and expressive shell

xiaq
10pts0
www.youtube.com 10y ago

Rust, Go, C++, D

xiaq
1pts0
www.youtube.com 10y ago

Keys to SRE

xiaq
2pts0
en.wikipedia.org 10y ago

Art gallery problem

xiaq
1pts0

Such old urban places would just be car-free in the Netherlands (sometimes with limited access for delivery and emergency vehicles), a trend fortunately becoming popular in other European cities now.

The “urban” in the title is a bit misleading, this intersection is definitely more suburban, or on the boundary of an urban center. (Or rather, the author has a different definition of urban - in my definition cities like den Bosch are really just a small medieval urban core surrounded by continuous medium-density suburban neighborhoods.)

I would love to see the diff between the hand-rolled recursive-descent parser and the ANTLR syntax!

I certainly feel the amount of boilerplate in my hand-rolled recursive-descent parser is manageable. Of course it's not as succinct as an EBNF grammar:

- For example, you have to write an actual loop (with "for" and looping conditions) instead of just * for repetition

- The Go formatter demands a newline in most control flows

- Go is also not the most succinct language in general

So you do end up with many more lines of code. But at the end of the day, the structure of each parsing function is remarkably similar to a production rule, and for simpler ones I can mentally map between them pretty easily, with the added benefit of being able to insert code anywhere if I need something beyond old-school context-free parsing.

Yeah, ultimately there's an element of personal taste at play.

The authoritative tone of "how to write ..." is meant in jest, but obviously by doing that I risk being misunderstood. A more accurate title would be "how I wrote ...", but it's slightly boring and I was trying hard to get my talk proposal accepted you see :)

Right, I may have forgot to mention that lexerless parsers are somewhat unusual.

I didn't have much time in the talk to go into the reason, so here it is:

- You'll need a more complex lexer to parse a shell-like syntax. For example, one common thing you do with lexers is get rid of whitespaces, but shell syntax is whitespace sensitive: "a$x" and "a $x" (double quotes not part of the code) are different things: the first is a single word containing a string concatenation, the second is two separate words.

- If your parser backtracks a lot, lexing can improve performance: you're not going back characters, only tokens (and there are fewer tokens than characters). Elvish's parser doesn't backtrack. (It does use lookahead fairly liberally.)

Having a lexerless parser does mean that you have to constantly deal with whitespaces in every place though, and it can get a bit annoying. But personally I like the conceptual simplicity and not having to deal with silly tokens like LBRACE, LPAREN, PIPE.

I have not used parser generators enough to comment about the benefits of using them compared to writing a parser by hand. The handwritten one works well so far :)

I don't have a version with captions, sorry. You can find the slidedeck at https://github.com/elves/elvish/blob/master/website/slides/2...

The remaining 8% mostly falls into the following categories:

- Code that use OS functionalities that are cumbersome to mock in tests

- Code paths that are triggered relatively rarely and I was simply too lazy to add tests for them

Nothing is impossible to cover, but for whatever reason it was too much work for me when I wrote the code.

However, it's worth mentioning that I only settled on the transcript test pattern fairly recently, and if I were to rewrite or refactor some of the untested code today I would add tests for them, because the cost of adding tests has been lowered considerably. So Elvish's test coverage is still increasing slowly as the cost of testing decreases.

That seems to be a bad translation, the original text means something like “sharpen something fully and it won’t last so long” (presumably due to it being more brittle). The text (like the rest of Tao Te Ching) is pretty vague and doesn’t actually refer to knives, so it could also be read metaphorically.

Elvish visibly leans into this to try to have a consistent syntax. Sometimes the similarities go deeper, too; IIRC, its number types are inspired by Scheme, for example.

Yes! Similarity to Lisp is very much a deliberate design choice and I feel happy every time a Lisper picks that up :)

I believe Elvish has also contributed a novel solution to the Lisp-1/Lisp-2 divide by making the space of command names equivalent to the subspace of variable names with a suffix - the command "foo" is equivalent to the variable "$foo~" and vice versa. (There's a bit more twist than that - the command "foo" can also resolve to the external command named "foo", but then that's represented by the "$e:foo~" variable.)

I take your comment as implying that https://elv.sh is nice, clean and elegant, and thank you for the compliment :)

I can't speak for other people, but I made it on my own and don't have any formal training in design.

With the risk of stating the obvious, you first have to realize that as a developer you can make a reasonably clean-looking website on your own. There are just a few basic ingredients: fonts, spacing, positioning, background shades, and rounded corners. You can do all of these from CSS and there is a lot of good resources for CSS today.

After that it's studying other websites, replicating the style you like, and a lot of trial and error. You can do a lot of experiments from the browser's dev tool before committing them into the stylesheet too. But at the end of the day, you have to put in some time. The layout of the current homepage was redone just a few months back and it took me (IIRC) 3 days to tweak everything to my satisfaction.

While I don't agree with most of your analysis - in particular for the second example, I'd invite you to read its explainer that goes into much more depth (https://elv.sh/learn/scripting-case-studies.html#update-serv...) - I think you might be more interested in the Oil Shell project, which is trying to chart a smooth upgrade path from bash: https://www.oilshell.org

I think we simply can't say for sure which path is better for the future of shells, and I'm quite excited by the fact that different projects are exploring different directions. I will just stick to the path I find best and won't try to convert you :)