|
|
 |
 |
 |
 |
TCL(Tool Command Language) Scripting
|
 |
 |
 |
 |
 |
 |
 |
 |
tcllib grammar::peg
Okay, so I got no replies asking for a simple example. My new question is this: does anyone use this at all? If not then what is the favoured parsing package? I was only looking to use the tcllib stuff because it comes bundled with the ActiveState distribution whereas nothing else does.
On Jun 1, 7:58 am, Nick Hounsome <nick.houns@googlemail.com> wrote: > Okay, so I got no replies asking for a simple example. > My new question is this: does anyone use this at all? > If not then what is the favoured parsing package? > I was only looking to use the tcllib stuff because it comes bundled > with the ActiveState distribution whereas nothing else does.
In addition to what someone with experience on the package might say, I'd like to propose a possible explanation for why heavy-metal (or even pure Tcl) parser engines are not that frequently needed. The idea is that for the specific use of computer-oriented parsing (e.g. programming languages and/or configuration files), with unambiguous context-free grammars (contextual constraints being handled by postprocessing), a very nice idiom consists of "translating" automatically the input string into one nested with { and }, mapping the intended language's nesting to Tcl's. The resulting string can then simply be fed to [eval]. Of course not all situations can be cast into this model. But when they do, you're harnessing the power and speed of the C routines of the Tcl parser, which is of course orders of magnitude faster than whatever you can do at the Tcl level. -Alex
Hi Nick, >My new question is this: does anyone use this at all?
never heard of it before. >If not then what is the favoured parsing package?
I once used Yeti (http://wiki.tcl.tk/2698) with good success. Of course, if you don't need "heavy lifting" parsing then Alexandre's suggestion could easily save you lots of work. >I was only looking to use the tcllib stuff because it comes bundled >with the ActiveState distribution whereas nothing else does.
Ok, Yeti doesn't come with this distro but the links on the page mentioned above are valid. HTH Helmut Giese
Nick Hounsome schrieb: > Okay, so I got no replies asking for a simple example. > My new question is this: does anyone use this at all?
IIRC its used in the 'page' application in tcllib/tclapps. The grammar stuff is Andreas Kupries baby, he might give advice how to use it. Michael
On 1 Jun, 11:11, schl@uni-oldenburg.de wrote: > Nick Hounsome schrieb: > > Okay, so I got no replies asking for a simple example. > > My new question is this: does anyone use this at all? > IIRC its used in the 'page' application in tcllib/tclapps. The grammar > stuff is Andreas Kupries baby, he might give advice how to use it. > Michael
I wonder why ActiveState put it in their binary distribution if it is so little used? My main motivation for originally posing the question is that I'm currently playing around on windows and IMHO the main benefit of TCL is being able to give someone a short script and a pointer to ActiveState or similar and they can get on with it without any compilation and without me having to produce any binaries. What I want it for is this: I'm playing around with graphviz (www.graphviz.org) and tcldot is not supported in windows. Yes I know that there is http://www.isn-oldenburg.de/~schlenk/tcl/tcldot but I thought that a simpler solution would be to just use the dot exes as filters as one option (-Tdot) gives the coordinates for everything so if I parse it then translation to canvas should be easy. I would LIKE to use the full generality of the dot language (www.graphviz.org/doc/info/lang.html) but it seems to be too general for simple regsub tricks although they could work OK for self generated graphs where I can use a simple form.
Nick Hounsome schrieb: > On 1 Jun, 11:11, schl @uni-oldenburg.de wrote: >> Nick Hounsome schrieb: >>> Okay, so I got no replies asking for a simple example. >>> My new question is this: does anyone use this at all? >> IIRC its used in the 'page' application in tcllib/tclapps. The grammar >> stuff is Andreas Kupries baby, he might give advice how to use it. >> Michael > I wonder why ActiveState put it in their binary distribution if it is > so little used?
Its part of tcllib and their apps (i don't remember exactly where), and Andreas is the main maintainer, contributor to tcllib, so its quite natural thats included (as he is at ActiveState too). > My main motivation for originally posing the question is that I'm > currently playing around on windows and IMHO the main benefit of TCL > is being able to give someone a short script and a pointer to > ActiveState or similar and they can get on with it without any > compilation and without me having to produce any binaries.
You know about starkits, right? > What I want it for is this: > I'm playing around with graphviz (www.graphviz.org) and tcldot is not > supported in windows. > Yes I know that there is http://www.isn-oldenburg.de/~schlenk/tcl/tcldot > but I thought that a simpler solution would be to just use the dot > exes as filters as one option (-Tdot) gives the coordinates for > everything so if I parse it then translation to canvas should be easy. > I would LIKE to use the full generality of the dot language > (www.graphviz.org/doc/info/lang.html) but it seems to be too general > for simple regsub tricks although they could work OK for self > generated graphs where I can use a simple form.
Ok, graphviz on windows. I don't have my vc6 setup anymore, but to make tcldot on windows working in a starkit isn't that hard in principle. - Build tcldot statically (with the right compiler options) with freetype and libz included - your done... Michael
On Jun 3, 10:50 am, Nick Hounsome <nick.houns@googlemail.com> wrote: > I would LIKE to use the full generality of the dot language > (www.graphviz.org/doc/info/lang.html) but it seems to be too general > for simple regsub tricks although they could work OK for self > generated graphs where I can use a simple form.
A cursory look at the abstract syntax shows mainly tail recursions (which are in the regular part of the grammar, hence reachable by "regexp tricks"). There *are* a few true (non-tail) recursions, but the overall syntax being unambiguous, it seems straightfowrad to apply the "translate-and-eval" trick to it. Ironically, the nesting tokens are already { and } ... Now nobody will prevent you from smashing flies with hammers ! -Alex
|
 |
 |
 |
 |
|