Add WORDEN operator to Algol 68
Introduces the WORDEN operator for type conversion in GCC's Algol 68 support.
This commit introduces the WORDEN operator for Algol 68 programs compiled with GCC. The operator is defined for SIZETY int, SIZETY real, and SIZETY bits, allowing conversions to their corresponding ‘word’ representations through truncation or extension. This functionality is added to the compiler’s Algol 68 library without including documentation or tests, which are planned for separate commits.
In Details
This patch adds the WORDEN operator to GCC's Algol 68 support, implemented in libga68. Prototypes for a68_lower_wordenint2 and a68_lower_wordenreal2 are added, and these functions are implemented in a68-low-prelude.cc. The WORDEN operator is defined in a68-parser-prelude.cc for SIZETY int, real, and bits types, enabling explicit conversion to a generalized 'word' type via truncation or sign/zero extension, consistent with Algol 68's type system.
- Algol 68
- An influential, early high-level programming language known for its complex syntax and powerful features, including a flexible type system and support for parallel processing.
- WORDEN
- An Algol 68 operator related to type conversion, specifically for obtaining a 'word' representation (integer, real, or bits) from other types through truncation or extension.
- SIZETY
- A mode (type) in Algol 68 representing fixed-size integer, real, or bits types. For example,
intis aSIZETY int. - truncation
- The process of shortening a number, typically by discarding fractional digits, when converting from a larger to a smaller data type or representation.
- extension
- The process of converting a number to a larger data type or representation, often involving sign extension for signed integers or zero extension for unsigned integers.