Up to Main Index                          Up to Journal for November, 2023

                   JOURNAL FOR SATURDAY 25TH NOVEMBER, 2023

SUBJECT: Mere ICE updated to v0.0.9
   DATE: Sat 25 Nov 19:42:43 GMT 2023

Mere ICE has been updated to v0.0.9 in the annexed works[1]. This update comes
six weeks after the v0.0.8 release. Mere has a new ‘any’ data type that can
hold the value of any other Mere data type. This is paired with a new ‘!any’
built-in conversion, from type any back to the original data type.

Variables can now be defined as constant using the new ‘const’ built-in.

With the addition of ‘any’ and ‘const’ there are now 53 reserved keywords.

Two compiler phases have been added. The first simplifies expressions such as
“x := (1 + 2) * 3” to “x := 9”. The second replaces references to constants
with the constant’s value, if it is a simple data type.

NOTE: Please make sure the version in the top right of Mere ICE shows ‘v0.0.9’
      and if not hard refresh the web page in your browser.

From the “What’s New” section:

  v0.0.9 — Saturday 25th November, 2023

    • New ‘any’ type added that can wrap any Mere data type. A variable of
      type any is shown with an ‘A’ short type in traces and dumps.

    • New ‘!any’ built-in conversion from a type any back to the original

    • New ‘const’ built-in for defining constants: const i := 3

      Constants display in the stack storage section of a dump annotated with
      a ‘c’:

                         -- Stack Storage --------------------
                        Line    Inst   Depth
                           3       9  Global
         non-constant →   0x0006:i  a                     5
             constant → c 0x0005:i  b                     3

    • Added ‘any’ and ‘const’ to reserved keywords, making 53 keywords.

    • Defined labels are now constants, and show in traces and dumps as

    • Variables of type label are display as ‘label(n)’ to distinguish them
      from normal ints. This is also in keeping with ‘regexp(…)’ and ‘any(…)’.

    • For clarity traces and dumps now show a ‘next’ built-in instead of a
      rewritten goto for loops.

    • Compiler has a new goto/next optimisation phase.

    • Compiler has a new expression optimisation phase. This can simplify
      expressions such as “x := (1 + 2) * 3” to “x := 9”.

      The operators currently simplified are:

      int, uint, float: add ‘+’, subtract ‘-’, divide ‘/’, multiply ‘*’

             int, uint: bit-wise AND ‘&’, bit-wise OR ‘|’, bit-wise XOR ‘^’,
                        bit-wise shift left ‘<<’, bit-wise shift right ‘>>’
                        modulus ‘%’,

                  uint: bit-wise NOT ‘!’

                string: concatenation ‘+’, repetition ‘*’,
                        extended string ‘~x’

               boolean: logical NOT ‘!’

         miscellaneous: open parentheses ‘(’, close parentheses ‘)’

    • Compiler has a new constants optimisation phase. If a constant evaluates
      to a simple value, after expression optimisation, then a reference to it
      will be replaced with the value itself.

    • Reinstated expanding an array into a map, alternating array elements for
      map key/value pairs:

        A := []string "a" "ant" "b" "bat" "c" "cat"
        M := [string] A
        println literal M // [string]("a" "ant", "b" "bat", "c" "cat")


  [1] The annexed works: /annex/

  Up to Main Index                          Up to Journal for November, 2023