help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Union Type Object problem


From: Hans Aberg
Subject: Re: Union Type Object problem
Date: Thu, 12 Aug 2004 13:28:55 +0200

At 10:35 +0200 2004/08/12, Laurence Finston wrote:
>> In discussion in the LaTeX3 project list
>> <address@hidden>, one said that Don shunned parser
>> generators and grammars when he did the TeX stuff. So, therefore TeX is as
>> it is, and it may difficult to use a parser generator to do a program that
>> exactly duplicates the original TeX-cluster of programs.
>>
>
>The TeX and Metafont languages are quite different, but they're similar
>in that they use a very low-level approach to programming.
>In a way, Knuth's approach was like using Pascal to write machine
>language.

I think that those that work with TeX, and especially extensions of it,
work in C, and not Pascal. For example, Omega does.

Bytes where precious back then. For example, FORTAN got its strange lexing
handling probably because it was good to be able to zip out the spaces on
the punchcards. But it also makes it impossible to implement a FORTRAN
compiler using a Flex/Bison setup (or so claims John Levine, the
comp.compilers moderator).

>While I admire it, but I have no ambitions of emulating it, at least not
>in 3DLDF.  Knuth does things like using sequences of bits within a machine
>word to store information about objects.

These are examples of things that were probably quite clever at the time,
with the computers of the day having such a limited power.

>  I've chosen to use common tools
>like Bison and the features supplied by C++.  I believe this will make my
>program more readily understandable to more people and that this
>outweighs any consequent loss of efficiency.

With the very powerful computers of today, that furthermore develop rapidly
into new models, it is likely a better strategy to settle for some more
structured high level code. One can then make specific optimizations at
need. Also, as computers have become cheap, the major expense is in human
developing time.

>While I can't prove it, I do believe that some things the Metafont parser
>does cannot be implemented using Bison.  I originally planned to try to
>make it possible for 3DLDF to process valid Metafont and MetaPost code.
>I've given up on this.  I also prefer a more succinct C-like syntax, so
>the 3DLDF language has begun to diverge from MF/MP.

If I were to write a typesetting program, I would not want to make it
directly TeX compatible, simply because of the quirks you mention.

Other approaches might though be to write say a Metafont code to 3DLDF
translator. You may even further admit the Metafont be included in segments
of its own syntax, similar to the "extern" construct in C++.

When I started to write my theorem prover, in the beginning, it had a
construct for including Prolog style code. Eventually, I departed so much
from the Prolog syntax and semantics, that it became a bother trying to
keep it in. So, at least for now, I have removed it. But it might be useful
to have such a feature later on.

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]