🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.tcl
Article #125

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

#125
From: et99
Date: Sun, 15 Nov 2026 01:17
49 lines
2815 bytes
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
Technical Details
Message-ID: <11db17p$2dfkd$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: et99 <et99@rocketship1.me>
Newsgroups: comp.lang.tcl
Subject: ANNOUNCE: calc v1.0.20 - Tcl expression compiler, now also a C
 extension
Date: Sat, 14 Nov 2026 17:17:44 -0800
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <11db17p$2dfkd$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 15 Nov 2026 01:17:46 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2539149"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+vs+IkUVQdjCN+dkp5b5Fh"; posting-host="5c717206e3c5ed20739dc35402509e44"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:2vkOXphdTd1Mnpg67f8dUBd71a8= sha256:FaeK8yAivXGCAKgJIFapexWts3Q773ZskGB+q7CaSr0=
	sha1:yk+sfWa+AE5vmLjAMMRCCEESGPM= sha256:oOj1Y4AxhXqpNGNIGyUlDhADCXhcJM0IfndY5ASp6L8=
Content-Language: en-US