LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Hans Aberg <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Wed, 10 Nov 1999 13:23:38 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (63 lines)
Here is an example, explaining an idea for an authoring language I got.
Instead of building on macro expansion, it builds on the lambda calculus,
using some principles of computer semantics I have developed (and is still
developing).

Perhaps the sample can be used as an input for LaTeX or somebody else
reading this list and is developing an authoring language.

The sample is this:

parse_rule command '<' [symbol] '|' [any_text] '|>':
    #1(#2).

define chess -->
    \x |-> format{PGN, date 1995/05/06, version 2}(\x)

<chess|game>


The line
    parse_rule command '<' [symbol] '|' [any_text] '|>':
        #1(#2).
means that a syntactic variable named "command" has been created. It relies
on the formerly defined syntactic variables "symbol" and "any_text" to pick
up text. The brackets [symbol] and [any_text] make the parsed text segments
(or rather their parsed objects, in case they are parse rules) get the
symbols #1 and #2. The last statement #1(#2) is a rule telling how the
semantics should be produced (like in Yacc). This rule makes use of the
computer semantics I developed, where objects have a single input (I skip
the details). Thus #1(#2) means "hand over a reference of object #2 to
object #1 for evaluation". Strictly speaking, it refers to the underlying
created (binary, runtime) objects and not the parsed text itself. This
becomes easier to understand when several parsing rules are hooked
together, each producing a semantic object; there will always be such
semantic objects at hand to combine.

In the line
    define chess -->
        \x |-> format{PGN, date 1995/05/06, version 2}(\x)
the "-->" is pronounced "evaluates to". This defines a lambda rule which
expands to a format called PGN which is used to denote chess games.

Let's see what happens with the line
    <chess|game>
According to the parse rule "command", this evaluates to
     chess(game)
and according to the "chess" lamnda expression, this evaluates to
     format{PGN, date 1995/05/06, version 2}(game)
This could also be written
  <chess|game>
    --> chess(game)
    --> format{PGN, date 1995/05/06, version 2}(game)

Thus, what it says is that the text "game" should be processed according to
the spec's of the PGN format.

I think one could develop a rather general authoring language using this idea.

  Hans Aberg
                  * Email: Hans Aberg <mailto:[log in to unmask]>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

ATOM RSS1 RSS2