Project Description This is a hobby project which has been under development for some years. It originally began in 2010 with the idea of creating a simple "C" interpreter and some work was done on a "C" style macro preprocessor and stack-based RPN parser. I noticed Salvatore Sanfilippo's 500-line Picol Tcl interpreter and I decided to migrate everything to a "pocket" Tcl interpreter project, especially as it could be put to some practical use in my field of work. In recent years I've put Ticol Tcl to use as an alternative to PowerShell which allowed me to quickly wrap scripts around my own custom built DLLs or EXE utils. I wanted something slightly less convoluted and more reliably portable across Windows platforms than PowerShell; something I could run immediately without altering the host system and which I could customise to my own taste and which would avoid frustrations trying to do anything moderately complex using Windows batch language. I ensured that I created documentation to help others make the most of the language. The Command Line Interface (CLI) has a man file with syntax highlighting which contains over 900 pages. Very little of the original Picol code remains. The project has grown to around 100,000 lines of C/C++ code for the basic interpreter EXE. I decided to call it Ticol (like "tickle") as an homage to the orignal Picol project. For an interpreter it is reasonably fast but obviously no match for compiled object code. I have implemented a number of language ideas which have originally been implemented in Tcl by porting them into "C" for higher performance. I've had the opportunity to try out a lot of ideas, some of which were better than others. Please note that Ticol Tcl is not yet feature-complete or expected to be fully stable. It has a disadvantage in that it does not support Unicode/MBCS characters. Nor does it offer regex functionality. It was written to fit a private design specification rather than a public one. It was intended to be used on relatively trivial background system scripts and for some years it has satisfied that design requirement. If you need more power and flexibility please consider a 'standard' Tcl. The program was developed for my own day-to-day use and amusement but I am happy to
share the binaries with anyone who finds it useful. Ticol is released under the BSD licence and is a closed-source project. Please see the
licence documentation and terms of use. |
Features
Ticol has the following features:
{*} expansion operator | Line-continuation \ character and flexible string definitions |
$$ multi-level dereferencing (complex double dereferencing) | loop (iterator) command |
4 byte double arithmetic to 15 decimal places | Macro preprocessor with conditional #define, #if #else #endif, #undef |
64 bit integer math as default | Macro conditional expressions using #if, #exec, #echo and #halt |
after, delayed execution | Macro #__LINE__ , #__DATE__ and #__TIME__ debugging options |
array set | Macro brace/bracket/quote parity with bug location line number for braces |
array_foreach | Macro preprocessor including optimisation of [expr] alias [calc] |
assert | Math functions for [expr] handler, separately callable via [funct] |
at_exit cleanup routine | MD5 commands |
Autoexec unknown commands | MD5 self-checking of scripts |
autoexec.tcl initialisation file | Messagebox |
base64 encode/decode | More console commands, e.g. [console], [gotoxy], [box], [textcolor] |
Base conversion between decimal, hex, and octal | Multi-line strings with format continuation |
Basic macro preprocessor with comment removal | native stacks |
BEDMAS (PEDMAS, BOMDAS) evaluation in [expr] and [calc] | Numerous additional functions/commands |
Big math plug | Octal math |
Binary math | Online (command line) help with keyword find |
Binary structs (no instantiation) | Performance graphing and timing using /G |
Built-in help (console and command-line) | Play WAV files |
C/C++ style long comments /* ... */ | Plugins to extend the interpreter |
CGI compatible, works well with Apache | Plugin LIB API interface for C/C++ |
CLI command-history (up/down cursors) | Portable. Requires only ticol.exe. Everything else is optional |
catch and try...catch | Preconfigured environment consts |
Code execution timing via catch and /G | printf / puts / format |
Code obfuscation/encryption binding to user/hostname/mac address or password | proc with default args |
Command line args: $argc, $argv() | Pseudo-namespace scoped vars x::y |
Command line Interface (CLI) capable of use as a windows shell | Random number commands using Mersenne-twister algorithms |
Conditional breakpoint debugging with halt, single-stepping and simple watches | Restricted execution. Bind to workstation, username, IP, password etc. |
Configurable CLI prompt | Runtime reconfiguration using [option] |
Const arrays | shell to O/S command |
Const variables | Simple HTTP data retrieval |
CRC plugin | Single-step debugging |
CSV file input to Tcl list or array | Some Variant handling for DLL interaction |
Customisable console prompt | Source code echo from command line (MPP parsed code) |
Date and time commands using decimal/VB/C# format | spawn application command |
DLL lib version in progress (call from other languages) | Stacks |
dump loaded source file | Stack trace on error |
dump variable or arrays | Standard expression math functions |
Dynamic configuration using [option] | Standard Tcl associative arrays using efficient, dynamic hash tables |
Dynamic memory allocation for source code loading | Static variables in procedures |
elseif | String comparison and handling functions |
encrypt/decrypt to a base64 string using simple, symmetric encryption | String splitting |
Enhanced info command with networking info | String wrapping |
enum enumerated consts | structs. Basic C-like binary structs for DLL interface marshalling usable by Tcl |
Environment variable $env() | struct instantiation using another struct as a template (new) |
Escape sequences (standard Tcl such as \r \n, \[ \$ etc.) | subst command |
exec application command | Switch (multi-line and single-line) |
Execution counter [info cmdcount] | Syntax check at macro preprocess time. Basic checks on braces, quotes etc. |
Execution locking via TCX files to user, hostname, IP address, MAC etc. | Syntax highlighter in command line interface |
Expression handler [expr] | Tcl command-line arguments |
Expression simplifier converts [expr] format to native Tcl | Tcl math expressions via [expr] and in flow control with many functions |
Extendable via C++ plugin API | Tcl v9-compatible octal notation 0oNN |
External DLL calling for __stdcall and __cdecl DLLs | TCX obfuscated scripts, embedded obfuscated soure, execution locking |
File handling routines [file]. [read], [write] etc. | Ternary (conditional) if (?:) within expr |
Floating point handling and math | Test scripts |
for flow control | Tested for memory leaks |
foreach flow control | time timer command |
fraction, integral | Type detection is automatic (hard and soft) |
global command | UAC elevation |
global scope ::proc | unknown/autoexec control |
Global scope reference ::y | uplevel |
goto_block with goto and gosub | upvar |
Hex math (integer unary and binary) | upvar arrays |
INI configuration file | Watch variable trace for use with debugger |
inputbox | WAV file playing |
Introspection via various means | Windows API copyfile command |
json to tcl list data conversion (rudimentary) | Windows input dialog with password masking |
list processing, including lassign, lsearch, lindex, lsort | Windows msgbox |
let command with multiple argument styles | Windows shell spawn and external execution with errorlevel return (exec) |
Advantages | Disdvantages |
|
|
Ticol Plugins
The following plugin DLLs are available. These are loadable using the [lib] command. See the manual for more information
Arbitrary precision math | CRC checksums | Network Letter Mapping | SMTP emailer |
ANSI text mode graphic display | CScript (VBScript) | Number to words conversion | Socket ping a host |
ARP and RARP commands | Dbase 3/4 Database | Random access database | SQLite 3 plugin |
Assembler Interpreter (TicASM) | DHCP commands | Roman to decimal conversion | TCX encoding |
Basic CPU information | DNS lookup | Scientific numbers | Text as an array |
Bitmap encoding | Embedded TCX handling | Simple FTP client | Traditional Linked Lists |
Brainfuck interpreter | HTML code processing | Simple registry services | VARIANT handling |
C-like arrays | ICMP ping | Simple RLE compression | Windows Event Logging |
Call an external DLL | INI file handling | Simple RTF text output | Windows service query |
CGI web interface | Misc routines | Simple ZIP package | Word or char count |
Configuring
an IDE Notepad++ is the recommended IDE An IDE (Integrated Developement Environment) is not the same thing as the Command line Interface (CLI). The Ticol CLI can be used to load, run and view scripts but not to edit them. You can, however, enter single line scripts from the CLI, even if these are comprised of multiple commands This page dicusses settting up and using Notepad++ syntax highlighting and run shortcuts |
Sub
Project - Pseudo-Assembler Interpreter This was an experiment in creating a fast interpreter using ideas for a minimalist languge. Both a Tcl script and plugin DLL are included which implement a 'pseudo-assembler' interpreter. The language is quite fast. Some Tcl scripts can be impemented in the pseudo assember language and run at little more than compiled EXE speed The native C++ plugin (ticol_asm.dll) runs some code faster than the parent Tcl interpreter so it might be handy for intensive number-crunching The ASM language specification is included and there is potential to generate a true compiler from the language spec. The language might be useful as a teaching-study aid in learning basic assembler concepts. It may also be fun seeing what can be done with the language A small library of "C" functions are available internally including, strlen, strstr, malloc, free etc. Externall DLLs such as MSVCRT may be linked and called and Ticol parent [eval] can be called to exploit the full range of Tcl commands The language and specification is working but feature-incomplete and subject to change See: help asm ticol_asm.dll - 63Kb - (plugin - Build date 15/May/2023) |
Sub
Project - Brainfuck Interpreter A Brainfuck interpreter script is included. This is also included as a compiled add-on plugin DLL written in native C++ and is also available as a standalone exe for performance comparison A selection of BF script files are included including a translation of a BASIC maze program and a simple fractal program, also ported to ASM from BASIC. The script versions is very slow as interpreter scripts running on an interpreter. However, this offers the challenge of writing code as efficiently as possible to enhance speed and has shown the benefit of invariant code optimisation in Ticol Tcl scripts See: help bf brainfuck.exe v1.01 - 40Kb (standalone) ticol_bf.dll - 39Kb - (plugin - Build date 15/May/2023) |
Testing
Security
Screenshots
More screenshots of Ticol in action are available
* API available when I get time to publish a detailed, worked example!
Last updated on 14 May 2023 - This page is designed for 1024 x760 and higher resolution displays