Nitpick Literal Formats
Nitpick enforces strict typing rules around literal
values. Because implicit type inference can lead to subtle
stateful compilation bugs (e.g., is 1 an
int32, int64, or
uint32?), Nitpick generally requires numeric
literals to carry their explicit type as a suffix.
1. Type Inference & Suffix Omission
While suffixes are required, the compiler provides one strict affordance for ergonomics: You may omit the literal suffix IF AND ONLY IF the value natively fits within the explicitly declared target type.
// Valid: 10 fits easily within the [-128, 127] bounds of int8
int8:small_val = 10;
// ERROR: 256 is out of bounds for int8.
// The compiler rejects this. To force it (and trigger a rollover/error),
// you would need explicit casts and suffixes: int8:bad_val = 256i16 => int8;
int8:bad_val = 256;
2. Numeric Base Suffixes
Nitpick abandons traditional C-style prefixes
(0x, 0b) in favor of uniform
Base Suffixes, adhering to the language’s
“things do not change based on context” rule (suffixes at
the end, not prefixes at the beginning).
- Hexadecimal: Digits (
0-9,A-F) followed byhex(e.g.,FFhexu32,10hex). - Binary: Digits (
0-1) followed bybin(e.g.,1010binu32). - Octal: Digits (
0-7) followed byoct(e.g.,77octu16). - Nonary (Base 9): Balanced nonary digits
(
0-4,A-D) followed bynonorn(e.g.,123noni64,4an).A-Drepresent negative values -1 to -4. - Ternary Sequence: Ternary digits
(
0,1,T) followed byt,ter, ortri. Used for bitmaskingtritandtrytetypes (e.g.,1T0Tt,1T0Tter, or1tri).
Note: Legacy C-style prefixes (0x,
0b, 0o, 0n) are
retained solely for C FFI compatibility but are discouraged
in native Nitpick code.
3. Numeric Suffixes
When a suffix is required (or provided pedantically), it is appended directly to the number without spaces.
- Standard Integers:
ifollowed by width (e.g.,42i32,255i8) - Unsigned Integers:
ufollowed by width (e.g.,0xFFu64,10u16) - Floating Point:
ffollowed by width (e.g.,3.14f32,2.718f64) - Fixed Point:
fix256(e.g.,100.0fix256) - Twisted Binary (
tbb):tfollowed by width (e.g.,42t32,-1t32). Uses standard decimal bases. - Twisted Float:
tffollowed by width (e.g.,3.14tf32) - Rational / Fractional:
fracfollowed by width (e.g.,1/3frac32)
4. Large Integers (LBIM) & Scientific Notation
Nitpick supports exceptionally large cryptographic
integers (int2048, int4096). To
prevent source files from exploding with thousands of
digits, these types do not support direct
source-code literals.
Instead, they are instantiated at compile/run time by parsing standard scientific notation strings.
// Creates a 2048-bit unsigned integer using scientific notation parsing
uint2048:crypto_key = parse_uint2048("1.5e308");
// Negative parsing for signed large integers
int4096:massive_neg = parse_int4096("-3.7e500");
5. Strings & Template Literals
Nitpick strings are first-class data citizens.
- Standard Strings: Enclosed in double
quotes
"". No interpolation.nitpick string:greeting = "Hello, world"; - Template Literals: Enclosed in
backticks
``. They preserve multi-line whitespace and support dynamic variable interpolation via the&{}syntax.nitpick int32:count = 5i32; string:report = `Total systems failing: &{count}`;