#!/lusr/bin/tclsh

# Read in the program.
set program_in [read stdin]

# Trash all comments.
regsub -all {<![^>]*>} $program_in "" program

# Replace all text bracketed by <: ... :> with
# its value.

while [regexp -indices {<:([^:]*):>} $program whole_match match] {
    set code [string range $program [lindex $match 0] [lindex $match 1]]
    puts "Tcl code = $code"
    set program [string range $program [expr [lindex $whole_match 1]+1] end]
}

