polyglot_parser
Se unió el 23 marzo 2025
Mensajes en el foro
-
Respondió en Cómo funciona un ensamblador de dos pasadas (con un trozo de Z80 a mano)
Great explanation, and a nice link back to Pratt: in both cases the trick is deciding what you need to know *first*. In the assembler's case, sizes before values. Do you know of an assembler that doe…
-
Respondió en comptime, templates and constexpr: three answers to "run code at compile time"
The "types are values at compile time" framing is the clearest I have seen. It also explains the cost: if types are first-class values, a type error can only be detected by running the evaluator, so …
-
Respondió en Por qué GCC se compila tres veces (el bootstrap en tres etapas)
Do you know whether anyone has studied the case where stage 2 and stage 3 differ because the compiler itself has an optimisation bug that depends on the compiler that built it? That sounds like the k…
-
Respondió en Monad tutorial no. 48: it is just `>>=` for Maybe, I promise
As a former linguist: "monad" explained via `Maybe` is the first time I thought "oh, this is just a grammar for sequencing with a side condition". Thanks for not mentioning category theory.
-
Respondió en Pratt parsing: operator precedence in twenty lines
Good catch, I cut it for space. A real version wants a token class with a position, so the message can say where the expression ended too early.
-
Inició Pratt parsing: operator precedence in twenty lines
If you are writing a hobby language, you will hit the expression problem early: `1 + 2 * 3` must parse as `1 + (2 * 3)`, and `2 ^ 3 ^ 2` must group to the right. Many people reach for a parser genera…
-
Respondió en Hi / hola: frontend dev, mucho dolor con el state
The counter trick is a tiny version of a "generation number", which is a recurring idea: a token that says which version of the world a message belongs to. It shows up in caches, databases, and game …
-
Respondió en Computing the WCAG contrast ratio by hand (and why #767676 is famous)
Small linguistic note from someone who stares at text: contrast is only one axis of legibility. Line length, line spacing, and the shapes of the letters matter just as much for people who read slowly…
-
Inició Tokenization is a grammar problem: why "it's" is not always one token
Splitting text into words sounds trivial until you try. Spaces are not enough: punctuation sticks to words, numbers contain dots, and `it's` is a word with an apostrophe inside it. A small regular-e…
-
Respondió en Linguist who ended up writing parsers
Deal. First one on the list: operator precedence ("climbing") is a context-free grammar in disguise, and the trick is just turning left recursion into a loop. I will write it up.
-
Inició Linguist who ended up writing parsers
I started in linguistics (syntax, mostly) and drifted into programming when I realised that a grammar I was drawing on a whiteboard could be run. Now I write small parsers and interpreters for fun an…