Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DSL: how to in Tcl?

205 views
Skip to first unread message

Sektor van Skijlen

unread,
Nov 15, 2005, 8:46:12 AM11/15/05
to
To avoid confusion: I mean Domain Specific Language ;)

I'm preparing a presentation for Tcl and I need some materials about making
DSL in Tcl. Does anybody knows something like that on the net? I couldn't cope
to find anything interresting by googling.

--
// _ ___ Michal "Sektor" Malecki <sektor(whirl)kis.p.lodz.pl>
\\ L_ |/ `| /^\ ,() <ethourhs(O)wp.pl>
// \_ |\ \/ \_/ /\ C++ bez cholesterolu: http://www.intercon.pl/~sektor/cbx
"I am allergic to Java because programming in Java reminds me casting spells"

Joe English

unread,
Nov 15, 2005, 11:56:45 AM11/15/05
to
Sektor van Skijlen wrote:
>To avoid confusion: I mean Domain Specific Language ;)
>
>I'm preparing a presentation for Tcl and I need some materials about making
>DSL in Tcl. Does anybody knows something like that on the net? I couldn't cope
>to find anything interresting by googling.


Tcl is an excellent base for creating domain specific languages.

Two good, early examples are Expect (for driving command-line
programs) and Tk (for creating GUIs). The first major project
I ever did in Tcl was Cost, a DSL for SGML processing.
More recently, see Jean-Claude Wippler's RATCL, a DSL for
relational algebra. I'm sure there are other examples out
there. These aren't commonly thought of as "domain-specific
languages" in the community -- most were invented before the
term "DSL" came into common use :-) -- but that's really what
they are.

Tcl has a number of characteristics that make it especially well-suited
for this sort of thing: a simple syntax (11 rules) with minimal
magic punctuation -- {}"[]$ and whitespace; and the related
doctrines of "everything is a string" and "everything is a command"
makes it easy to define new data and control structures.


--Joe English

Helmut Giese

unread,
Nov 15, 2005, 2:06:31 PM11/15/05
to
Hi,

>To avoid confusion: I mean Domain Specific Language ;)
>
>I'm preparing a presentation for Tcl and I need some materials about making
>DSL in Tcl. Does anybody knows something like that on the net? I couldn't cope
>to find anything interresting by googling.
FWIW, at the end of the 'cryptarithms' page on the wiki there is a
marvellous example of
"Little languages in action"
Don't know if this fits the bill but you may want to have a look.
HTH
Helmut Giese

Sektor van Skijlen

unread,
Nov 15, 2005, 3:22:05 PM11/15/05
to
Dnia 15 Nov 2005 16:56:45 GMT, Joe English skrobie:

> Sektor van Skijlen wrote:
> >To avoid confusion: I mean Domain Specific Language ;)
> >
> >I'm preparing a presentation for Tcl and I need some materials about making
> >DSL in Tcl. Does anybody knows something like that on the net? I couldn't cope
> >to find anything interresting by googling.

> Tcl is an excellent base for creating domain specific languages.

Huh! That is why I am keen to increase the knowledge about it in my company as
well as encourage people to start using it. For me it is enough to be able to
imagine, how flexible is Tcl in such a use as DSL.

But I need something more than stating that Tcl is excellent. Something
concrete. Something that will throw the people out of their chairs. ;)))

> Two good, early examples are Expect (for driving command-line
> programs) and Tk (for creating GUIs).

Yes, the presentation about Tcl will include Tk and Expect. I'm going to show
some simple Tk applications and simple Expect scripts.

> The first major project
> I ever did in Tcl was Cost, a DSL for SGML processing.

http://www.flightlab.com/cost/ ?

Hmm... loox nice. What would you advice me to show as a nice example? This
topic looks like needing some specific knowledge and if I cannot "accept"
something very quickly it is rather unsuitable for presentatuion. On the other
hand, I know that the presentation need not be comprehensible to be
enthusing... ;)

Seriously; I'd like to show the people something that will show them that Tcl
is not "just another programming language", but rather a base for specific
languages. Having Tcl you don't have to spell up your own special syntax; you
just base on Tcl's syntax and you can even provide specific "syntax
extensions", however mostly using commands and braces. This is what I want to
exlain in examples.

> More recently, see Jean-Claude Wippler's RATCL, a DSL for
> relational algebra.

http://www.equi4.com/raintro.html ?

Thumping ;)

> I'm sure there are other examples out
> there. These aren't commonly thought of as "domain-specific
> languages" in the community -- most were invented before the
> term "DSL" came into common use :-) -- but that's really what
> they are.

Hmm... I think, Google should start a new service called "keywords", divided
into specific categories. Something like a central "point of understanding"
between the page publisher and page searcher.

> Tcl has a number of characteristics that make it especially well-suited
> for this sort of thing: a simple syntax (11 rules) with minimal
> magic punctuation -- {}"[]$ and whitespace; and the related
> doctrines of "everything is a string" and "everything is a command"

Unless something is a variable ;)

> makes it easy to define new data and control structures.

Yes. I also created something that can freely be called DSL:

http://wiki.tcl.tk/12701

;)

I think the examples you mentioned are worth using in the presentation.
Thanx!!! ;)

Cameron Laird

unread,
Nov 15, 2005, 4:08:06 PM11/15/05
to
In article <dld40...@news4.newsguy.com>,
Joe English <jeng...@flightlab.com> wrote:
.
.
.

>there. These aren't commonly thought of as "domain-specific
>languages" in the community -- most were invented before the
>term "DSL" came into common use :-) -- but that's really what
>they are.
.
.
.
I think folks were saying "DSL" by the end of the 80s ... maybe
quite a bit earlier.

Donal K. Fellows

unread,
Nov 15, 2005, 5:48:24 PM11/15/05
to
A neat example is embedding other languages within Tcl, but the coolest
aspect is that you do not have to stick to a single DSL per program.
Try showing a single script that combines Tk, Expect, SQLite and
CriTcl; that gives you something that would be *very* hard to do with
almost any language other than Tcl. :-) For that matter, every time you
write an expression in Tcl, you're using a DSL that's embedded in the
language itself...

Donal.

Michael A. Cleverly

unread,
Nov 15, 2005, 8:33:12 PM11/15/05
to
On Tue, 15 Nov 2005, Sektor van Skijlen wrote:

> To avoid confusion: I mean Domain Specific Language ;)
>
> I'm preparing a presentation for Tcl and I need some materials about making
> DSL in Tcl. Does anybody knows something like that on the net? I couldn't cope
> to find anything interresting by googling.

Does the example in
http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/d1
f386899ab78510/ count as a DSL? I rather like making existing data into
something that can be [source]'d in its own right.

Michael

Neil Madden

unread,
Nov 16, 2005, 7:54:57 AM11/16/05
to
Sektor van Skijlen wrote:
> To avoid confusion: I mean Domain Specific Language ;)
>
> I'm preparing a presentation for Tcl and I need some materials about making
> DSL in Tcl. Does anybody knows something like that on the net? I couldn't cope
> to find anything interresting by googling.

The wiki has numerous examples of DSLs, and you can find some in the
archives of this newsgroup too. For instance, here is a post with a
little DSL for rule-based game AI I knocked up a little while ago:

http://groups.google.co.uk/group/comp.lang.tcl/msg/5aa88dd1eed4c617

That example is perhaps small and self-contained enough (if less than
complete) to demonstrate how easy it is to do this sort of thing in Tcl.

Richard Suchenwirth has numerous good examples of DSLs on the wiki. One
of my favourites is "iShow" - a little presentation system:
http://wiki.tcl.tk/8985 which again is small enough to demonstrate in
its entirety for your coworkers. You could even use it for the
presentation itself!

Cheers,

Neil

Gerry Snyder

unread,
Nov 16, 2005, 1:12:35 PM11/16/05
to
Neil Madden wrote:
>
> The wiki has numerous examples of DSLs, and you can find some in the
> archives of this newsgroup too. For instance, here is a post with a
> little DSL for rule-based game AI I knocked up a little while ago:
>
> http://groups.google.co.uk/group/comp.lang.tcl/msg/5aa88dd1eed4c617
>
> That example is perhaps small and self-contained enough....

Small? What do you mean "small"?

Your PowerPoint emulation requires almost half a page of code! <LOL>

I have already got some good ideas just from looking it over, and intend
to give it some study as a possible basis for a tiny help system I need.

Thank you for the posting.

Gerry

0 new messages