[comp.text.sgml] What would it take to implement SGML in TeX?

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (10/08/90)

Shouldn't it be possible to implement SGML in TeX? Among other things,
this would give SGML an opportunity for wide use---which it doesn't
really deserve, but that's a side issue.

---Dan

dhosek@frigga.claremont.edu (Hosek, Donald A.) (10/09/90)

In article <3745:Oct805:47:1890@kramden.acf.nyu.edu>, brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes...
>Shouldn't it be possible to implement SGML in TeX? Among other things,
>this would give SGML an opportunity for wide use---which it doesn't
>really deserve, but that's a side issue.

Oh sure. TeX is Turing-complete. It's possible to implement
_anything_ in TeX (ask Andrew Marc Greene ;-). Whether it would
be practical is a whole other issue. The general approach taken
is to run an SGML parser which translates the markup into TeX
commands.

-dh

---
Don Hosek                       TeX, LaTeX, and Metafont support, consulting 
dhosek@ymir.claremont.edu       installation and production work. 
dhosek@ymir.bitnet              Free Estimates.
uunet!jarthur!ymir              Phone: 714-625-0147
                                finger dhosek@ymir.claremont.edu for more info

eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (10/09/90)

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:

>Shouldn't it be possible to implement SGML in TeX? Among other things,
>this would give SGML an opportunity for wide use---which it doesn't
>really deserve, but that's a side issue.

Just for fun I implemented (with Nico Poppelier) a simple DTD
in TeX. Not translating: just changing the syntax of TeX
a bit and writing clever macros. Of course it was a *simple* DTD,
but still.

This is not the way to do it, however. TeX being the weird 
programming language it is, you'd better write a translator in
C or Pascal or so.

>---Dan

Victor

spqr@ecs.soton.ac.uk (Sebastian Rahtz) (10/09/90)

In article <3745:Oct805:47:1890@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:

   Shouldn't it be possible to implement SGML in TeX? Among other things,
   this would give SGML 

I am not sure what you mean; in the simplest case, are you saying
`write an SGML DTD which describes LaTeX'? if so, it could be done,
I think, if you adopt the widest possible interpretation of the
syntax. Or do you mean write a (La)TeX macro package that looked like
a common SGML DTD? Remember that SGML isn't a piece of software, so
you can't implement it! the the trouble with TeX is the ease with which
the user can define new commands...

   an opportunity for wide use---which it doesn't
   really deserve, but that's a side issue.
Is SGML *designed* for widespread use? so far as I am concerned, its a
system for  describing documents for interchange with other people.
Therefore I will carry on writing in TeX for my own purposes and if I
ever want to offer the document to the world, I'll make it conform to
SGML-itis and find a DTD. Since I (and all other LaTeX and troff -mm
and scribe users) have been writing generic markup for years, there
should be no problem :-} ... except describing the syntax of LaTeX
unequivocally. 


--
Sebastian Rahtz                        S.Rahtz@uk.ac.soton.ecs (JANET)
Computer Science                       S.Rahtz@ecs.soton.ac.uk (Bitnet)
Southampton S09 5NH, UK                S.Rahtz@sot-ecs.uucp    (uucp)

ath@prosys.se (Anders Thulin) (10/09/90)

In article <3745:Oct805:47:1890@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
>Shouldn't it be possible to implement SGML in TeX?

It might be possible to implement some kind of pseudo-SGML, that is
something which would look like a SGML document, without actually
being one.

One part of a SGML document is the Document Type Declaration (the DTD)
which specifies the syntax of the document text: in which order tags
come, if certain tags must follow other tags and so on. Implementing
this in TeX is probably not worth while.

It would probably be easier to adapt the NIST SGML parser to spit out
TeX code instead of parsed SGML.

-- 
Anders Thulin       ath@prosys.se   {uunet,mcsun}!sunic!prosys!ath
Telesoft Europe AB, Teknikringen 2B, S-583 30 Linkoping, Sweden

iwm@doc.ic.ac.uk (Ian Moor) (10/10/90)

I used to use GML (which I presume is (was) related to SGML), from Waterloo,
this was implemented in Waterloo Script (somewhat like runoff). They added one
feature to Script to allow commands to be anywhere in the text, not just line
beginnings. It should be possible to use TeX, which is rather more versatile.

In my opinion, the real problem is error reporting. Assuming that the 
implementation is done by use of macros (\def), SMGL errors will often result 
in reports of errors by TeX in terms of the generated code. This can be seen
to some degree in LaTeX, but I suspect that SMGL, being more configurable
might produce more confusing reports.

Pick a versatile lexer/parser generator or perhaps a Macroprocessor like
ML/1 and do a translation to TeX.

--
Ian W Moor
  ARPA: iwm@doc.ic.ac.uk
  JANET: iwm@uk.ac.ic.doc
           
 Department of Computing,         (The skin is mightier than the banana)
 Imperial College.                
 180 Queensgate                   
 London SW7 UK.                   

tim@maths.tcd.ie (Timothy Murphy) (10/14/90)

In <3745:Oct805:47:1890@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:

>Shouldn't it be possible to implement SGML in TeX? Among other things,
>this would give SGML an opportunity for wide use---which it doesn't
>really deserve, but that's a side issue.

A speaker at the Cork conference -- I think it was
Victor Eijkhout (u641001@hnykun11.bitnet) --
claimed to have done exactly that,
if I understood him correctly.

-- 

Timothy Murphy  

e-mail: tim@maths.tcd.ie