العرضar

Translation status: العربية reader-locale proof. Code fences render through the ar pipeline; prose is canonical Latin.

Bitwise and, or, xor, not, and shifts on numerus operands.

Syntax: <expression> ∧ <expression> | <expression> ⊻ <expression> | ¬ <expression> | <expression> ⇐ <expression> | <expression> ⇒ <expression>

Category#

bitwise

Examples#

radix/corpus/operatores/bitwise.fab (canonical · operator-group)#

Bitwise and, or, xor, not, and shifts on numerus operands.

# =============================================================================
# ∧ — Bitwise and, or, xor, not, and shifts on numerus operands.
# =============================================================================
#
# What this teaches:
#   • Bitwise operators — `∧` (and), `∨` (or), `⊻` (xor), `¬` (not), `⇐` (shift left), `⇒` (shift right).
#   • Integer bit patterns — Visual demonstration of bitwise operations with binary literals.
#
# Common mistakes:
#   • Confusing ∧ (bitwise and) with et (logical and) — they operate at different levels.
#
# See also: ∨, ⊻, ¬, ⇐, ⇒
# =============================================================================

# operatores/bitwise — ∧ ⊻ ¬ ⇐ ⇒
#
# GRAMMAR:
#   bitwiseExpr :← expr ('∧' | '⊻' | '⇐' | '⇒') expr | '¬' expr
#
# EXPECTED OUTPUT:
#   8, 6, 16, 4
#
# BACKEND:
#   Integer bit patterns; cross-ref binarius/binarius.fab for combined tour.
#   Unary ¬ documented in syntax; Rust emits `~` (whitelist if reintroduced in body).

main {
    const _ vexilla  0b1010
    const _ persona  0b1100

    const _ coniuncta  vexilla ∧ persona
    # 8 (0b1000)
    print coniuncta

    const _ diversa  vexilla ⊻ persona
    # 6 (0b0110)
    print diversa

    const _ sinistra  14
    # 16
    print sinistra

    const _ dextra  162
    # 4
    print dextra
}

Expected output:

8
6
16
4