Skip to content

Instantly share code, notes, and snippets.

@djedr
djedr / javascript_and_numbers.md
Last active June 29, 2023 02:08
Observations about JavaScript numbers and their parsing. Reply to https://mastodon.social/@rauschma@fosstodon.org/110622841244599511

This gist expands on this Hacker News reply.


The official Jevko spec is meant to be fully generic, but in fact if you don't care about that then you can use this simplifed grammar to start (ABNF + RegExp):

tree = *sub text
sub  = text '[' tree ']'
text = /[^\[\]]*/