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

tcl grammar

128 views
Skip to first unread message

Shihying Chen

unread,
Dec 19, 1998, 3:00:00 AM12/19/98
to
Is there a grammar of Tcl?
SY


Paul Duffin

unread,
Dec 21, 1998, 3:00:00 AM12/21/98
to
Shihying Chen wrote:
>
> Is there a grammar of Tcl?
> SY

Probably not in the sense that you mean (BNF). Look at the Tcl man
page for a description of the syntax.

--
Paul Duffin
DT/6000 Development Email: pdu...@hursley.ibm.com
IBM UK Laboratories Ltd., Hursley Park nr. Winchester
Internal: 7-246880 International: +44 1962-816880

Cameron Laird

unread,
Dec 21, 1998, 3:00:00 AM12/21/98
to
In article <367B4967...@sbchm1.sunysb.edu>,

Shihying Chen <sc...@sbchm1.sunysb.edu> wrote:
>Is there a grammar of Tcl?
>SY
>

<URL:http://www.scriptics.com/man/tcl8.0/TclCmd/Tcl.htm>
--

Cameron Laird http://starbase.neosoft.com/~claird/home.html
cla...@NeoSoft.com +1 281 996 8546 FAX

Shih-Ying Chen

unread,
Dec 21, 1998, 3:00:00 AM12/21/98
to
Paul Duffin wrote:

> Shihying Chen wrote:
> >
> > Is there a grammar of Tcl?
> > SY
>

> Probably not in the sense that you mean (BNF). Look at the Tcl man
> page for a description of the syntax.
>

Sorry for the confusion. Yes, I meant BNF notation.
I would like to build a tool to parse a tcl program before I run it.
With BNF notation , I can use Bison (or yacc) to build the tool.
By the way described in the tcl manual, it's a little troublesome. :)
Maybe it's fun to tranform those syntax into BNF.
SY

Paul Duffin

unread,
Dec 22, 1998, 3:00:00 AM12/22/98
to

Tcl's grammar is defined by the commands that are available and it is
possible for a program to change the built in commands and create other
functions which in other languages would need to be builtin.

lvi...@cas.org

unread,
Dec 23, 1998, 3:00:00 AM12/23/98
to

According to Shih-Ying Chen <sc...@sbchm1.chem.sunysb.edu>:
:Sorry for the confusion. Yes, I meant BNF notation.

:I would like to build a tool to parse a tcl program before I run it.
:With BNF notation , I can use Bison (or yacc) to build the tool.
:By the way described in the tcl manual, it's a little troublesome. :)
:Maybe it's fun to tranform those syntax into BNF.

The want


<URL: http://www.purl.org/NET/Tcl-FAQ/part3.html>:

From: -XI- Where can I get these packages?
Subject: -G- BNF style notation for Tcl


<URL: mailto:tb...@CS2.cc.lehigh.edu> (TERRENCE MONROE BRANNON) in July of 1993,
posted some yacc code for a tcl-to-c parser. This, along with Adam Sah's Tcl
compiler, are a couple of sources with which folk could start.
--
<URL: mailto:lvi...@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.

Victor Wagner

unread,
Dec 26, 1998, 3:00:00 AM12/26/98
to
Shihying Chen (sc...@sbchm1.sunysb.edu) wrote:
: Is there a grammar of Tcl?
: SY

No. And it is very important thing to understand.

Tcl is not based on conventional LALR parser. It rather have very short
list of basic substitution rules (rather lexical level then grammar
level) described in Tcl(n) man page and set of command, which is
extensible. Anything in Tcl (inculding for, if and such) is just a
command with list of args.

So, any attempt to create yacc-like grammar for Tcl would probably
end-up in incomplete, if not incompatible parser.
Really, there should be Tcl interpreter, to understand how command set
changes upon proc and rename invocations, as well as on package require
and package forget. And don't forget autoloading and eval.
--
--------------------------------------------------------
I have tin news and pine mail...
Victor Wagner @ home = vi...@wagner.rinet.ru

0 new messages