[Remind-Fans] New release of Remind coming soon; testers wanted

Dianne Skoll dianne at skoll.ca
Fri May 31 22:15:43 EDT 2024


Hi!

Do you love living on the bleeding edge?  Juggling chainsaws, fiery torches
and rubber chickens?  Running with scissors?

If so, I invite you to check out a branch containing upcoming changes
to Remind:

https://git.skoll.ca/Skollsoft-Public/Remind/src/branch/wip/revamped-expression-evaluation

I started writing Remind in 1989 and added support for expressions probably
around 1992 or so.  It was very early in my software career and "expr.c"
was not my proudest moment.

So... I've completely rewritten the expression engine in Remind.
Instead of parsing and evaluating an expression in one go, it parses
it into an internal representation and then evaluates that.  This
gives us goodies like short-circuit && and || operators.
Additionally, iif() and choose() only evaluate those specific
arguments they care about.

So please give it a go and let me know if you notice any bugs.  Please note
that "make test" will FAIL because I have not updated the test suite yet.

But have a look at this:

    FSET factorial(x) iif(x <= 1, 1, x * factorial(x-1))
    SET a factorial(4)

In the stable version of remind:

    $ remind -dx factorial.rem
    Entering UserFN factorial(4)
    x => 4
    4 <= 1 => 0
    x => 4
    x => 4
    4 - 1 => 3
    Entering UserFN factorial(3)
    Leaving UserFN factorial() => Recursive function call detected
    Leaving UserFN factorial() => Recursive function call detected
    factorial.rem(2): 
    factorial.rem(1): In function `factorial': Recursive function call detected

In this bleeding-edge branch with a lot of output omitted:

    $ remind -dx factorial.rem 
    Entering UserFN factorial(4)
    ...
    Entering UserFN factorial(3)
    ...
    Entering UserFN factorial(2)
    ...
    Entering UserFN factorial(1)
    x => 1
    1 <= 1 => 1
    iif(1, 1, ?) => 1
    Leaving UserFN factorial(1) => 1
    2 * 1 => 2
    iif(0, ?, 2) => 2
    Leaving UserFN factorial(2) => 2
    3 * 2 => 6
    iif(0, ?, 6) => 6
    Leaving UserFN factorial(3) => 6
    4 * 6 => 24
    iif(0, ?, 24) => 24
    Leaving UserFN factorial(4) => 24

Huzzah!  Recursive functions.  Note also how the debug output shows
a "?" for arguments that iif() didn't bother evaluating.

Regards,

Dianne.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://dianne.skoll.ca/pipermail/remind-fans/attachments/20240531/dcb87d7f/attachment.sig>


More information about the Remind-fans mailing list