Thread View: comp.lang.tcl
1 messages
1 total messages
Started by et99
Sun, 15 Nov 2026 01:17
ANNOUNCE: calc v1.0.20 - Tcl expression compiler, now also a C extension
Author: et99
Date: Sun, 15 Nov 2026 01:17
Date: Sun, 15 Nov 2026 01:17
49 lines
2815 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads