• ANNOUNCE: calc v1.0.20 - Tcl expression compiler, now also a C extension

    From et99@et99@rocketship1.me to comp.lang.tcl on Sat Nov 14 17:17:44 2026
    From Newsgroup: comp.lang.tcl


    Calc v1.0.20 is out. Calc compiles a C-like expression syntax into Tcl
    bytecode through tcl::unsupported::assemble, so the expressions run at
    expr speed:

    : { a=3; b=4; c=5;
    x = a*b + c;
    y = x > 10 ? x : -x;
    y++
    }

    proc= f {args} {
    : args -> (a, b, c)
    return "a=$a b=$b c=$c"
    }

    What's new:

    * C extension (calcext.c). One "load" replaces "package require
    colon", with the same results as the Tcl module. Compiling is
    about 2x faster, proc= definitions and transform= about 4x faster,
    and each extra interpreter or thread starts in a fraction of a
    millisecond instead of several. Compiled code runs at the same
    speed either way. Prebuilt calcext.so and calcext.dll are
    attached to the release for Tcl 8.6 and for Tcl 9.x.

    load ./calcext.so ;# or ./calcext.dll

    * Language: ++ and -- (prefix and postfix), short-circuit && and ||,
    nested ?: without parentheses, tuples such as (x,y,z) = list and
    list -> (x,y,z), and Calc::transformProcs to compile existing
    procs.

    * Fixes: code following a braced block on the same line is no
    longer dropped, and an unterminated block now gives an error
    instead of looping forever.

    * Tests: calc.test (324 tests) runs against either the module or the
    extension, plus a mutation-testing harness. Checked on Tcl 8.6 and
    9.x on Linux; the Windows DLLs were checked to load and work on 8.6
    and 9.x.

    Source, docs and downloads: https://github.com/rocketship88/colin-parser/releases/tag/v1.0.20

    Feedback and bug reports welcome.

    et99

    --- Synchronet 3.22a-Linux NewsLink 1.2