131 karma · joined January 16, 2025
False. This is how you define a language _to a parser generator_, but it is not how humans (and/or developers) define languages to each other.
> you won't realise you've made it
This is literally impossible in a recursive descent parser. I'm not saying getting it wrong is impossible, of course not. But what you literally cannot do (without concerted intentional effort) is make it ambiguous. Your parser will parse one first, or the other first, or either one left-to-right; and you will know which of these it does by reading the code.
Other ads just take up screen space and bandwidth: they displace more useful uses of these scarce resources, but they don't cause any direct harm. By contrast, ads targeting people in the market for a good or service actively displace quality signals. In doing so they make quality uneconomical and thus destroy it. They make the world a worse place.
It's important to note that ambiguities are something which exist in service of parser generators and the restricted formal grammars that drive them. They do not actually exist in the language to be parsed (unless that language is not well-specified, but then all bets are off and it is meaningless to speak of parsing), because they can be eliminated by side-conditions.
For example, one famous ambiguity is the dangling 'else' problem in C. But this isn't an actual ambiguity in the C language: the language has a side-condition which says that 'else' matches to the closest unmatched 'if'. This is completely unambiguous and so a recursive descent parser for C simply doesn't encounter this problem. It is only because parser generators, at least in their most academic form, lack a way to specify this side-condition that their proponents have to come up with a whole theory of "ambiguities". (Shockingly, Wikipedia gets this exactly right in the article on dangling else which I just thought to look up: "The dangling else is a problem in programming of parser generators".)
Likewise goes the problem of left-recursion. Opponents of recursive descent always present left-recursion as a gotcha which requires some special handling. Meanwhile actual programmers writing actual recursive descent parsers don't have any idea what these academics are talking about because the language that they're parsing (as it exists in their mind) doesn't feature left-recursion, but instead iteration. Left-recursion is only introduced in service of restricted formal grammars in which recursion is the only available primitive and iteration either doesn't exist or is syntactic sugar for recursion. For the recursive descent user, iteration is a perfectly acceptable primitive. The reason for the discrepancy goes back to side-conditions: iteration requires a side-condition stating how to build the parse tree; parser generators call this "resolving the ambiguity" because they can't express this in their restricted grammar, not because the language was ambiguous.
> How do you implement a recursive descent algorithm for parsing a JSON file?
That is a 100% reasonable interview question. It's not _quite_ how I would phrase it, but it's not out of distribution, as it were.
It does not; but when you learned about gravity in school or wherever, you were only presented with scenarios in which it was valid to do so. Specifically, for Newtonian gravity, an object whose density is spherically symmetrical may be treated as a point mass at its center (w/r/t other point masses farther from the center than any point in the first object); this can be seen by integrating Newton's equation.
There's no reason to attribute this to special behavior by gravity with respect to "objects" which you identify. You could decompose a (spherically symmetrical) mass into several different spherically symmetrical "objects" and sum up their influence on a test mass, and the result is the same as if you had treated the original mass as a point mass. The hypothesis that gravity is "treating" the object one way or another now fails to distinguish all these possibilities; it's no longer physically meaningful.
At sufficiently large distances, or for sufficiently large ratio of large to small mass, the difference between, say, a planet and a spherically symmetrical mass is so small with respect to the main effect that it can simply be ignored.
In contrast, in the type theories behind proof assistants like Coq, Lean, and Agda, recursion is intimately tied to _finite_ structures. Instead of the vague "intersection of all sets such that" which we see in the article here, recursion is a well-defined computational process, and defined in a rather obvious way once you're familiar with the background.
What you have described is literally the syscall mechanism. That's what it is. You perform some register write (via a specific instruction) and an interrupt is taken to the kernel. Maybe you believe that an asynchronous interrupt would cost less than a synchronous interrupt for this particular objective but I'm not sure there's evidence for that claim.
Isn't this historically inaccurate? Wasn't Einstein looking for an explanation for why Maxwell's equations mysteriously assigned a constant velocity to electromagnetic phenomena, apparently contradicting Galilean relativity?
:set rnu
:set nu
will change the gutter to display relative line numbers for all but the current line.FWIW I would very rarely if ever use '5dd'; to me that is spelled 'd4j'. ':set rnu' obviously influences this, since the last line to be copied is labeled '4'.
Undo is 'u' and, yeah, you probably need to know that one before starting. Even after over 15 years using vim I still make tons of mistakes and change my mind, and a fairly robust undo system is crucial.
There's a problem with how the law is written though... It supposedly required Trump to notify Congress before he was even President, but its requirements also only apply to the President. Arguably the law was impossible to follow as written, and I gather that's not even the strongest constitutional problem with the law as written. What we have here is a failure of Congress, and Trump exploiting it.