- From: Armen Michaeli via GitHub <sysbot+gh@w3.org>
- Date: Thu, 26 Sep 2024 10:17:05 +0000
- To: public-css-archive@w3.org
Thank you for chipping in (again), appreciate your elaboration. I think one still needs to establish what "exactly" exactly means in this context, or in other words what constitutes "sameness" and "equivalence" between two specification-compliant parse trees (since there's specified a grammar, after all). The [Selectors] specification does not explicitly define _parsing_ procedures, there's only the grammar and other bits in the Syntax and Values & Units specifications to go by. As such, one could in principle have two parsers but where one builds one type of structure containing _the same_ tokens as another parser with another type of structure. I assume when you mention "exact", you're admitting that two such parse trees are both equivalent, ref. "observable result", despite _different_ internal structure(s) of their respective parse trees? For instance, I have a parser generator that generates a parser that, parsing "foo" as a selector list expression (`selector_list` in the grammar), returns, due to being auto-generated recursive descent parser, an array of arrays that somewhere contain "foo" in the form of an `<ident-token>` object, say `[ [ ident_token("foo") ] ]` (expressed with JavaScript syntax). Another parser may, parsing the same input as the same grammar production, simply return `ident_token("foo")` (again, JavaScript syntax). Are both parse results permissible by the spec.? The way I understand your last comment, they are, but wanting to write a specification-compliant implementation, I want to be sure, and unfortunately the spec. itself does not make it clear. A grammar is not a parser, admittedly, so if I were more experienced in writing parsers, I could, perhaps, simply assume that the spec allows _any_ parser which _somehow_ vends the same sequence of tokens (as another parser) for same input when parsing the same production. In the implementation I am writing I have a "flatten" procedure that takes a parser _product_ (as I call it, aka a branch of a parse tree) and vends all contained tokens, hence "flattening" the product. I would imagine then, sameness and equivalence and exactness can be defined as "if the result of parsing input in accordance to a given production constitutes the _same_ _ordered_ set of tokens as another result, the results are equivalent/same in this context". What would you say to that? -- GitHub Notification of comment by amn Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10944#issuecomment-2376537172 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 26 September 2024 10:17:06 UTC