Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: convert to ecmarkup #172

Merged
merged 3 commits into from
Mar 6, 2025
Merged

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Mar 3, 2025

This PR migrates our spec from Bikeshed to Ecmarkup, trying to keep the changes between the two versions as minimal as possible (i.e. only where we use some bikeshedisms that do not work with Ecmarkup).

I still need to make GitHub pages work, but for now you can:

  1. Clone this branch
  2. Run npm ci
  3. Run node --run build or node --run watch
  4. Serve the out folder and open it in the browser

This PR unlocks possible improvement, such as @szuend's grammar-based VLQ parsing definition, but they will be done in follow-ups.

Preview: https://nicolo-ribaudo.github.io/source-map/branch/ecmarkup/

@nicolo-ribaudo nicolo-ribaudo requested a review from takikawa March 3, 2025 16:53
@nicolo-ribaudo nicolo-ribaudo changed the title Convert to ecmarkup Editorial: convert to ecmarkup Mar 3, 2025
Copy link
Collaborator

@takikawa takikawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks for doing the conversion! I left some comments about small issues, LGTM other than those.

@szuend
Copy link
Collaborator

szuend commented Mar 4, 2025

This does indeed look great! I only have small concern that we tie decoding very closely to Ecma262 language semantics.

E.g. we could spec decoding of mappings as syntax directed operations over a grammar like

<emu-grammar type="definition">
  Mappings :
    `;` Mappings
    MappingList Mappings?

  MappingList :
    Mapping
    MappingList `,` Mapping

  Mapping :
    GeneratedColumn
    GeneratedColumn OriginalSource OriginalLine OriginalColumn
    GeneratedColumn OriginalSource OriginalLine OriginalColumn Name

  GeneratedColumn : Vlq
  OriginalSource : Vlq
  OriginalLine : Vlq
  OriginalColumn : Vlq
  Name : Vlq
</emu-grammar>

then we wouldn't need to use String.prototype.split.

We can do that as a follow-up though to get us started.

@nicolo-ribaudo nicolo-ribaudo force-pushed the ecmarkup branch 3 times, most recently from 64b72f5 to 7e2977b Compare March 4, 2025 11:05
@nicolo-ribaudo nicolo-ribaudo force-pushed the ecmarkup branch 5 times, most recently from 8a2b273 to d8c28be Compare March 4, 2025 11:44
@nicolo-ribaudo nicolo-ribaudo force-pushed the ecmarkup branch 9 times, most recently from 8c22f58 to 9aa06fe Compare March 4, 2025 12:22
@nicolo-ribaudo
Copy link
Member Author

nicolo-ribaudo commented Mar 5, 2025

I pushed an update that still relies on ECMA-262's data types, so that we don't have to re-define them, but it only uses its basic version of objects (https://tc39.es/ecma262/#sec-object-type), without all the special behavior that JS supports on top of it. I also define a "JSON object" and "JSON array", which we can use across the specification rather than referring to ECMA-262's object (a JSON object is more restrictive, because it guarantees that it's deeply JSON-compatible).

The way those utilities read properties from the object (Let _prop_ be _object_'s own property whose key is _key_) is the same used by ECMA-262 to interact with its Object type at the most fundamental level (e.g. https://tc39.es/ecma262/#sec-ordinarygetownproperty).

I also redefined string.split: we'll probably not needed it once we do Simon's grammar suggestion, but for now it avoids having to go read how string splitting works in ECMA-262.

(trying to get the preview to auto-update...)

@takikawa
Copy link
Collaborator

takikawa commented Mar 5, 2025

I looked through the latest changes wrt ECMA-262 datatypes and left some comments. Otherwise the new changes LGTM.

Copy link
Collaborator

@szuend szuend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Thanks!

@nicolo-ribaudo nicolo-ribaudo force-pushed the ecmarkup branch 2 times, most recently from ad928aa to 6bbb203 Compare March 6, 2025 10:43
@nicolo-ribaudo nicolo-ribaudo merged commit 7427cda into tc39:main Mar 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants