Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Binary Literals

Binary Literals

Binary Literals are a feature.

A binary number is a number expressed in the base-2 numeral system or binary numeral system, a method of mathematical expression which uses only two symbols: typically "0" (zero) and "1" (one).

Languages with Binary Literals include Java, JavaScript, Python, Perl, MySQL, Swift, Haskell, Prolog, Elixir, Julia, Reason, F#, Verilog, Eiffel, OCaml, D, VHDL, Chapel, BlitzBasic, Coq, Monkey, Zig, F*, Ceylon, SystemVerilog, Opa, Isabelle, AspectJ, K, Felix, Jule, Futhark, MiniD, BlitzMax, ooc, Whiley, Logtalk, Earl Grey, parasail, FloScript, nimrod, Savi, CBOR data definition language, Croc

Example from Java, AspectJ:
// 0[bB][01][01_]*[lL]?
Example from JavaScript:
// 0[bB][01]+n? 0b100110100000110011110010010
Example from Python:
# 0[bB](?:_?[01])+
Example from Perl:
# 0b[01]+(_[01]+)*
Example from MySQL:
-- b'[01]+'
Example from Swift:
// 0b[01_]+
Example from Haskell:
-- 0[bB]_*[01](_*[01])*
Example from Prolog:
% 0b[01]+
Example from Elixir:
# 0b[01]+
Example from Julia:
# 0b[01]+((_[01]+)+)?
Example from Reason, MiniD:
// 0[bB][01][01_]*
Example from F#:
// 0[bB][01][01_]*[uU]?[yslLn]?
Example from Verilog:
// ([0-9]+)|(\'b)[01]+
Example from Eiffel:
-- 0[bB][01]+
Example from D:
// 0[Bb][01_]+
Example from VHDL:
-- B"[01_]+"
Example from Chapel:
// 0[bB][01]+
Example from Monkey:
' \%[10]+
Example from Ceylon:
// \$([01]{4})(_[01]{4})+
Example from SystemVerilog:
// ([1-9][_0-9]*)?\s*\'[sS]?[bB]\s*[xXzZ?01][_xXzZ?01]*
Example from K:
/ [01]+b
Example from Felix:
// 0[Bb][01_]+([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?
Example from Jule:
Example from Whiley:
// [01]+b
abstract-types-feature.html 路 binary-numbers-feature.html 路 binary-operators-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 33 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub