Module procedure

Source
Expand description

§Procedure expression parsing and evaluation.

This module provides parsing and evaluation support for procedure expressions in the AIMX language. Procedures represent sequences of conditional expressions separated by semicolons (;) and typically form the body of closure expressions.

§Syntax

Procedures support two forms:

  • Single expression: expression
  • Multiple expressions: expression; expression; ...

When multiple expressions are present, they are evaluated sequentially and the result of the last expression is returned as the procedure’s result.

§Examples

// Simple procedure - single expression
x + 1

// Multi-expression procedure - evaluates each expression but returns the last one
x * 2; x + 3; x - 1

// Used in closures with the map function
(5).map(x => x * 2; x + 1)  // Returns 11 (5*2=10, then 10+1=11)

Enums§

Procedure
Represents a procedure (sequence of expressions) in the AIMX language.

Functions§

parse_procedure
Parses a procedure expression from the input string.