Meta-language for mxTextTools

Christian Tismer tismer at appliedbiometrics.com
Thu Jul 15 12:28:05 EDT 1999


"Tony J. Ibbs (Tibs)" wrote:
> 
> Christian Tismer <tismer at appliedbiometrics.com> wrote:
> > I got the impression: Why another language?
> 
> Yes, that always makes me uncomfortable too. Although, really, the original
> tuple form is *already* another language (just a very low level one).
> 
> > Can't we express the tagging tuples by Python programs?
> > Marc's tuples are nothing more than predefined actions,
> > conditions, and jumps to labels.
> >
> > Given a restricted subset of Python, and a couple of known
> > functions which are to be used, the tags could be expressed
> > as a small number of Python functions, and
> > it would be a real application for the ByteCodeHacks
> > to turn these Python functions back into tagging tables.
> > We would go without any parsing since Python does it for us.
> 
> Strangely enough, I have had exactly this thought myself.

That's good to hear.
I have often the wish to write something in a python-ish style,
without actually generating Python code but something else.

> I guess the reply is in two parts:
> 
> 1. I wanted to keep this to something simple that I could have a hope of
> implementing myself. In the very, very restricted spare time I have (we have
> two small children!) I *might* just be able to use this little language as a
> way into learning mxTextTools and produce something I can write quicker than
> the tuples themselves. Simple text transforms to produce a "mini-language"
> is something I've done before and can give back seemingly amazing progress
> for little effort.

Now, that's a good thing. Can you express the parser for the little
language with the tagging engine? That would be a funny bootstrap :-)

> 2. I can't help feeling that "jump-to-label" (aka
> skip-forwards/backwards-N-statements) is intrinsically necessary in such an
> engine, and I can't see any way of doing that sensible whilst keeping to
> Python syntax.

if target_of_jump_is("thisone"):
   # do this
if target_of_jump_is("thatone"):
   # do that

... and so on.
This is the syntax which I use for my computed goto example with
continuations. Man, this is all so similar. Where does the yourney go.

> 3. I rather wanted not to hack Python itself, and to keep independent of
> whether one is using CPython, JPython (which OK, can't use the current
> mxTextTools anyway) or some other language accessing the DLL. Perhaps a bit
> spurious, this one.

Yes, and it's number 3 already.

> (BTW, there is no comfy chair)
> 
> Oh, I just thought of:

Is it allowed to go until 4 in this joke? I don't remember :-)

> 4. Also, for me, I think that the way to go from the original tuple-form to
> (perhaps) a final form as Python programs would be via something I can think
> in more easily than the original tuples - so perhaps in the end this "little
> language" will be no more than a half-way house.
> 
> Having said all of the above, I am definitely not averse to someone else
> coming up with something better, or explaining to me why what I am doing is
> the hard way to do it and, look, here is a lazier way...

No, feel encouraged to continue! I was just blathering about what
came to mind.

> > Whoops - I could make the tagging engine into a pluggable
> > interpreter for stackless Python, this is just another engine.
> 
> Please feel free - you do that and I will happily use it...

Isn't a tagging engine a number of comparisons, head
movements, and gotos? Continuations could do that.

> > yes-I-have-to-duck-and-cover-ly y'rs - chris :-)
> 
> Oh, I don't know, it seemed sensible to me (hint: not a recommendation!)

kids-don't-try-that-at-home-ly y'rs - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home




More information about the Python-list mailing list