ticol.gif (1129 bytes) Ticol TCL Interpreter

Project Description

This is purely 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. Some extremely basic "C" code could be processed. My interest was piqued by Salvatore Sanfilippo's 500-line Picol Tcl interpreter and I decided, after playing around with the code, to migrate everything to a Tcl interpreter project

Over recent years I've put Ticol Tcl to practical use as an alternative to PowerShell which allowed me to wrap scripts around custom built DLLs.  I wanted something more portable and less frustrating than PowerShell, 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 expands to around 700 pages when printed

Very little of the original Picol code remains other than a modified parser core and the project has grown to around 100,000 lines of C/C++ code for the basic interpreter binary.  I decided to call it Ticol (akin to "tickle") as an homage to the orignal Picol project. For an interpreter it is reasonably fast but obviously no match for compiled "C" 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 better than others

Ticol Tcl is not yet 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

The program was developed for my own 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


screenshot-static-source-x560.png (79031 bytes)

Features

Ticol has the following features:

{*} operator loop (iterator) command
$$ multi-level dereferencing Macro preprocessor with conditional #define, #if #else #endif, #undef
4 byte double arithmetic to 15 decimal places Macro conditional expressions using #if, #exec, #echo and #halt
64 bit integer math as default Macro #__LINE__ , #__DATE__ and #__TIME__ debugging options
after, delayed execution Macro brace/bracket/quote parity with bug location line number for braces
array set Macro preprocessor including optimisation of [expr] alias [calc]
array_foreach 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 file processing 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 capable of being used 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.
Expression handler [expr] Syntax highlighter in command line interface
Expression simplifier converts [expr] format to native Tcl Tcl command-line arguments
Extendable via C++ plugin API Tcl math expressions via [expr] and in flow control with many functions
External DLL calling for __stdcall and __cdecl DLLs Tcl v9-compatible octal notation 0oNN
File handling routines [file]. [read], [write] etc. TCX obfuscated scripts and embedded obfuscated soure code
Floating point handling and math Ternary (conditional) if (?:) within expr
for flow control Test scripts
foreach flow control Tested for memory leaks
fraction, integral time timer command
global command Type detection (hard and soft)
global scope ::proc UAC elevation
Global scope reference ::y unknown/autoexec control
goto_block with goto and gosub uplevel
Hex math (integer unary and binary) upvar
INI configuration file upvar arrays
inputbox Watch variable trace for use with debugger
Introspection via various means WAV file playing
json to tcl list data conversion Windows API copyfile command
list processing, including lassign, lsearch, lindex, lsort Windows msgbox
let command with multiple argument styles Windows shell spawn and external exec exe call with errorlevel return (exec)
Line-continuation \ character -

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 calculation HTML code processing simple FTP client Socket ping a host
ARP and RARP commands Dbase 3/4 Database INI file handling Simple ICMP ping SQLite 3 plugin
Basic CGI interface DHCP commands json_to_list Simple registry services Variants for calldll
Basic CPU information DNS lookup Lines as array Simple RLE compression Windows Event Logging
Binary Linked Lists Drive Letter Mapping Misc routines Simple RTF text output Windows service query
C-Like fixed arrays Embedded TCX handling Random access  database Simple ZIP package Word or char count
Call an external DLL HTML code highlighting Roman to decimal convert SMTP emailer

 

Advantages Disdvantages
  • Works on a wide range of Windows from NT to Win 10, ReactOS and WINE
  • Compact, flexible, reasonably fast
  • Plugins availalable
  • Ability to call external DLLs easily with binary structs
  • Well-documented
  • Easy to learn
  • Good introspection and debugging for a script language
  • Suited to specialist administrative IT tasks and educational use
  • Big math, registry, ftp and email capabilities
  • File and database operations
  • Script obfuscation and execution restriction
  • Plugin API available*
  • DLL version, callable from C++
  • Freeware
  • Windows only, no Linux version
  • A pure interpreter so slower than ActiveState Tcl and many other script languages
  • Does not support Unicode / non-Roman languages
  • Not a full Tcl implementation and there are some differences
  • Some parts of the language are incomplete
  • The language has some peculiarities
  • No sockets or multithreading
  • Minimal static code error checking
  • Weak in relation to binary string handling
  • Closed source
  • No support offered
  • Tcl is often not taken as a serious programming language
  • In many cases ActiveState Tcl, Jim or PowerShell would be better

 

Documentation

The HTML and RTF documentation covers around 700 printed pages and external RTF/HTML/TXT copies are generated using Tcl scripts and the highlighter plugin. This shows the capabilities of syntax highlighting and handling moderately large amounts of data quite quickly.  Creating the RTF and HTML files from 36,000 lines of text, including complex syntax-highlighting takes under 11 seconds on an i5

The following links will open in a new window. Most of the useful documentation, complete with examples is in the HTML manual and built in 'man' page, accessible from the Ticol Command Line Interface (CLI) via: help topic

The manual contains an FAQ section as well as discussions about coding style, errors and details of commands

The following links will open in a new window:

help-comparison-x450.png (90397 bytes)

Downloads

Downloads - Ticol Binaries  (Pending release)

File MD5 Description
yyyymmdd-ticol-distro.zip - Ticol Tcl full distribution v1.26 (ZIP format) - Approx 4900 Kb
ticol.exe - EXE only v1.26 (ZIP format) - 215 Kb
ticol-minimum.zip - ticol.exe, autoexec, manual v1.26 (ZIP format) - 0 Kb
distro-plugins.zip - All available Ticol  (ZIP format) - 1983 Kb
distro-tests.zip - Unit tests and supporting files as a self-contained folder
ticol.ini N/A sample configuration file - 0 Kb
hanoi.tcl.txt N/A Sample Ticol Tcl script - 3 Kb
Ticol-threaded.exe - Experimental threaded compile. v1.26 (ZIP format) - 0Kb
autoexec.tcl.txt - Sample autoexec.tcl file 1kb (rename to autoexec.tcl)
ticol-dll.zip - Project sample calling DLL version of Ticol (ticol.dll)
ticol-embedded.exe 70a78d36d902c137f53cabb857ec2807 Example embedded script (hanoi.tcl)

Downloads - Supporting Binaries

md5.exe Required to validate the MD5 signatures
base64.exe Required to convert TCX files to Base64 [tcx] command format
wver.exe Windows version identification
hanoi.exe Performance comparison between native C++ and hanoi.tcl - 0Kb

 

Compatibility

Ticol Tcl has been tested with the aim of having it work with everything from Windows NT4.0 SP6a to Server 2016 and it has been in live daily use on Server 2012R2 and Server 2016. The language was developed under Windows 7

It is less compatible with versions of Windows prior to XP but almost all built-in features work fine.

Some of the more advanced features don't work well with ReactOS at present (e.g. ticol_ping.dll) but basic tests work ok with ReactOS v0.4.8. The screenshot here shows an earlier version of Ticol working fine on ReactOS under Oracle Virtualbox

Ticol implements around 90% of standard Tcl commands. Many Tcl scripts will run without modification. Ticol contains many additional and enhanced commands. Check the online documentation / man file for more details

reactos-zip-demo-x450.png (77762 bytes)

 

Configuring an IDE

Notepad++ is the recommended IDE.

The 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

npp-screenshot-x450.png (101200 bytes)

Testing

Security

Support

Due to time constraints I am unable to offer support with this software. Scriptlanguage support can be incredibly time consuming. Good bug reports are, however, welcomed although as this is a hobby project I can't guarantee a fix time or detailed reply. When submitting a bug report, try to be as detailed as possible, include copies of any relevant scripts and, if possible, screenshots. Keep the total email size < 1Mb

Before submitting a bug report, check out the "Tips and Tricks", "Ticol Workarounds" and "Troubleshooting and Common Mistakes" sections of the manual

Bug reports or change/feature requests may be sent to 'ticol' @ this domain

Screenshots

A few screenshots of Ticol in action are available

Tips and Discussion

Many tips are covered in the Ticol manual but others are discussed here

Example Code

Some simple example Tcl scripts

Recommended Reading

Alternatives

Comic Sans?

People who don't like Comic Sans don't know anything about design


* API available when I get time to publish with a worked example!

Back | Top

Last updated: 2018/Jul/30