PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Octals

Octals

Octals are a language feature.

Base-8 number system, and uses the digits 0 to 7. Often represented by putting a "0" before the number (or -0 for negative octals). So 010 = 8, 0100 = 64.

Languages with Octals include Java, JavaScript, Python, Go, Perl, Swift, Haskell, Prolog, Julia, Elixir, OCaml, F#, D, Chapel, Verilog, Eiffel, Reason, PostScript, VHDL, Zig, Hy, Boo, IDL, Protocol Buffers, AutoIt, Opa, F*, Coq, AutoHotkey, SystemVerilog, Cython, Isabelle, Puppet, AspectJ, Cryptol, Felix, ooc, GLSL, Golo, Meson, Logtalk, HLSL, SourcePawn, Earl Grey, Pawn, FloScript, nimrod, CBOR data definition language

Example from Java, AspectJ:

// 0[0-7_]+[lL]?

Example from JavaScript:

// 0[oO]?[0-7]+n?

Example from Python:

# 0[oO](?:_?[0-7])+

Example from Go:

// 0[0-7]+

Example from Perl:

# 0_?[0-7]+(_[0-7]+)*

Example from Swift:

// 0o[0-7_]+

Example from Haskell:

-- 0[oO]_*[0-7](_*[0-7])*

Example from Prolog:

% 0o[0-7]+

Example from Julia:

# 0o[0-7]+((_[0-7]+)+)?

Example from Elixir:

# 0o[0-7]+

Example from F#:

// 0[oO][0-7][0-7_]*[uU]?[yslLn]?

Example from D:

// 0[0-7_]+

Example from Chapel:

// 0[oO][0-7]+

Example from Verilog:

// ([0-9]+)|(\'o)[0-7]+

Example from Eiffel:

-- 0[cC][0-7]+

Example from Reason:

// 0[oO][0-7][0-7_]*

Example from PostScript:

% [0-9]+\#(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)((e|E)[0-9]+)?(?=[()<>\[\]{}/%\s])

Example from VHDL:

-- O"[0-7_]+"

Example from Hy:

; 0[0-7]+j?

Example from Boo:

# 0\d+

Example from Protocol Buffers:

// 0[0-7]+[LlUu]*

Example from AutoIt, AutoHotkey:

; 0\d+

Example from SystemVerilog:

// ([1-9][_0-9]*)?\s*\'[sS]?[oO]\s*[xXzZ?0-7][_xXzZ?0-7]*

Example from Felix:

// 0[0-7_]+([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?

Example from Golo:

# 0[0-7]+j?

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements · Email · GitHub