Languages like Tcl that have configurable syntax?
Posted
by
boost
on Programmers
See other posts from Programmers
or by boost
Published on 2013-10-20T13:41:53Z
Indexed on
2013/10/20
16:08 UTC
Read the original article
Hit count: 276
programming-languages
|syntax
I'm looking for a language that will let me do what I could do with Clipper years ago, and which I can do with Tcl, namely add functionality in a way other than just adding functions.
For example in Clipper/(x)Harbour there are commands #command, #translate, #xcommand and #xtranslate that allow things like this:
#xcommand REPEAT;
=> DO WHILE .T.
#xcommand UNTIL <cond>;
=> IF (<cond>);
;EXIT;
;ENDIF;
;ENDDO
LOCAL n := 1
REPEAT
n := n + 1
UNTIL n > 100
Similarly, in Tcl I'm doing
proc process_range {_for_ project _from_ dat1 _to_ dat2 _by_ slice} {
set fromDate [clock scan $dat1]
set toDate [clock scan $dat2]
if {$slice eq "day"} then {set incrementor [expr 24 * 60]}
if {$slice eq "hour"} then {set incrementor 60}
set method DateRange
puts "Scanning from [clock format $fromDate -format "%c"] to [clock format $toDate -format "%c"] by $slice"
for {set dateCursor $fromDate} {$dateCursor <= $toDate} {set dateCursor [clock add $dateCursor $incrementor minutes]} {
# ...
}
}
process_range for "client" from "2013-10-18 00:00" to "2013-10-20 23:59" by day
Are there any other languages that permit this kind of, almost COBOL-esque, syntax modification?
If you're wondering why I'm asking, it's for setting up stuff so that others with a not-as-geeky-as-I-am skillset can declare processing tasks.
© Programmers or respective owner