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

Prefix syntax for binary #17

Open
nishihatapalmer opened this issue Jul 13, 2019 · 3 comments
Open

Prefix syntax for binary #17

nishihatapalmer opened this issue Jul 13, 2019 · 3 comments

Comments

@nishihatapalmer
Copy link
Owner

nishihatapalmer commented Jul 13, 2019

v3 has syntax for matching binary bytes and hex bytes. The normal prefix for binary bytes is 0b. For hex it is 0x.

However, hex bytes are first class citizens in byteseek, so don't need the 0x prefix. The problem is that "0b" is a valid hex byte in its own right, so creates an ambiguous syntax. Does 0b01010101 match a single byte, or does it match a sequence of 5 hex bytes?

Because of this ambiguity, I'm proposing that the prefix for binary is "0i" instead of "0b".

  • 0i01010101 matches a single byte with the binary value given.
  • 0b01010101 matches a sequence of 5 byte values.

I've tried all the other letter in "binary" for an alternative to "0b", and "0i" seems to be the right one.

  • "n" sounds like a generic "number", not "binary": "0n01010101".
  • "a" doesn't sound like anything: "0a01010101"
  • "r" is just strange: "0r01010101"
  • "y" kind of works as the last letter since "x" is for hex, so "y" could be binary: 0y01010101.

I think "0i" works better than "0y", but not entirely sure. "0y" is visually more distinct than "0i", and has the virtue of being the last letter like the standard hex syntax.

@nishihatapalmer
Copy link
Owner Author

Some examples:

0i00001111 0y00001111
0i01010101 0y01010101
0i00001111 0y00001111

@nishihatapalmer
Copy link
Owner Author

I think I like the visual distinctness of "0y" over "0i". The "i" looks very like a 1, which makes it hard to read.

@nishihatapalmer
Copy link
Owner Author

The more I see the 0i prefix, the more I find it visually confusing. Going to give the 0y prefix a go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant