|Language to describe document formats? email@example.com (1996-04-29)|
|Re: Language to describe document formats? firstname.lastname@example.org (Alaric B. Williams) (1996-05-03)|
|From:||"Alaric B. Williams" <email@example.com>|
|Date:||3 May 1996 00:02:07 -0400|
>I wonder if it is possible (I mean easy really) to define a language
>to describe the formats of, say, wordprocessor documents. Such
>language would help user applications to read from/write to the
>required format. Currently, in many applications each document format
>is supported using one module for read and another module for write;
>each has to be written/debugged/installed separately. With a format
>language, one specification is enough. And we save those time
>otherwise spent on writing yet another conversion utility.
Interesting. It would (by definition) be declarative, so the
conversion can run 'both ways' (with imperative code, there would, as
you say, need to be two modules).
I imagine that it could work in 'layers', ie layer zero might deal
with raw data - the format of chunks, compression, encryption, and the
like, while layer 1 could split text from command codes, layer 2 deal
with the commands, etc.
That way, the task of running it in reverse is split into the reversal
of each layer, and then reording the layers, rather than reversal of
the whole thing. Might make compiling it easier, and it would
certainly help find bugs, being modular.
At one end, the interface to the actual file would need the standard
wide range of file access things. Would it be worth supporting
documents that straddle files? Ie, seperate 'index file' of some kind,
or a style template, or something. Just something to think about.
At the other end, how would it specify the text that is actually in
the document? Perhaps you could make the interface the same at either
end of the stream, and convert to/from a general format. This might be
more portable than a syntax-level interface to the viewer application.
Perhaps you could just write a writing predicate in Prolog, then ask
it what input document would create the desired document :-)
Alaric B. Williams Internet : firstname.lastname@example.org
Return to the
Search the comp.compilers archives again.