ATOMIC AI CONDITIONALS AND LOGIC SPEC (EN) SCOPE RULE: This document defines the complete and binding conditional and logical system of the Atomic language. RULE: All rules defined here are mandatory. RULE: No conditional or logical construct exists outside this specification. CONDITIONAL INSTRUCTION RULE: Atomic supports exactly one conditional instruction. RULE: The only conditional instruction is: se RULE: No other conditional instructions exist. SYNTAX OF THE SE INSTRUCTION RULE: The general syntax is: se { code } RULE: The block delimited by curly braces is mandatory. RULE: Single-line conditionals without braces are not allowed. CONDITIONAL EXECUTION SEMANTICS RULE: is a logical expression. RULE: The condition is evaluated at the moment the se instruction is executed. RULE: If the condition evaluates to true, the block is executed. RULE: If the condition evaluates to false, the block is not executed. RULE: No implicit alternative branch exists. UNSUPPORTED CONDITIONAL CONSTRUCTS FORBIDDEN: altrimenti else else if altrimenti se switch case pattern matching ternary operators RULE: Any alternative conditional behavior must be implemented using multiple se instructions. LOGICAL EXPRESSIONS RULE: A logical expression is an expression that produces a boolean value. RULE: Atomic boolean values are: vero falso RULE: vero is equivalent to numeric value 1. RULE: falso is equivalent to numeric value 0. COMPONENTS OF A LOGICAL EXPRESSION RULE: A logical expression may include: boolean constants variables predefined variables logical operators comparison operators mathematical expressions round parentheses LOGICAL OPERATORS RULE: Atomic supports only the following logical operators: e o o esclusivamente non RULE: This list is closed. LOGICAL OPERATOR SEMANTICS RULE: e returns true if both expressions are true. RULE: o returns true if at least one expression is true. RULE: o esclusivamente returns true if exactly one expression is true. RULE: non inverts the logical value of the expression it is applied to. RULE: Logical operators operate on boolean values. COMPARISON OPERATORS RULE: Atomic supports comparison operators for numeric values. RULE: Supported symbolic comparison operators are: < > = <= >= != RULE: Comparison operators return a boolean value. TEXTUAL COMPARISON OPERATORS RULE: Atomic supports textual forms of comparison operators. RULE: Textual comparison operators: are semantically equivalent to symbolic operators must start with the word "è" RULE: Valid textual forms are: è uguale a è maggiore di è minore di è maggiore o uguale di è minore o uguale di è diverso da FORBIDDEN: Textual comparison forms not starting with "è". LOGICAL PRECEDENCE RULE: Atomic uses standard logical precedence rules. RULE: Evaluation order is: round parentheses non comparison operators e o and o esclusivamente RULE: Round parentheses may be used to modify evaluation order. NUMBERS IN LOGICAL EXPRESSIONS RULE: Numeric values may be used in logical expressions. RULE: Any numeric value less than 0.5 evaluates to false. RULE: Any numeric value greater than or equal to 0.5 evaluates to true. FRAME-BASED EVALUATION RULE: If a se instruction is inside CICLO CONTINUO: the condition is evaluated at every frame RULE: If the program does not explicitly define events: se instructions are executed in the implicit CICLO CONTINUO NON-SUPPORTED LOGICAL FEATURES FORBIDDEN: documented short-circuit behavior ternary logic switch or case constructs RULE: All conditional behavior must be expressed using: se logical operators comparison operators FORMAL CLOSURE RULE: The conditional and logical system of Atomic is limited to what is described in this document. RULE: Any undocumented conditional or logical behavior: is invalid is not part of the Atomic language