help-3dldf
[Top][All Lists]
Advanced

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

[help-3dldf] Re: Macros in 3DLDF


From: Laurence Finston
Subject: [help-3dldf] Re: Macros in 3DLDF
Date: Thu, 30 Dec 2004 15:39:03 +0100 (MET)

Hello,

I have given some more thought to macros in 3DLDF.  I have
removed the `defuns' which I had implemented and am in the
process of replacing them with objects that I'm calling `macros'.

I think that it may be impossible to implement
Metafont-like macros using `suffix', `expr', and `text'
arguments unless I were to make major changes to the Bison
parser for 3DLDF.  I'm pretty sure it
wouldn't be possible with a reasonable amount of effort
within a reasonable time, and I do not want to make major
changes to the parser.

Instead, I've decided to make it possible to define macros
using two kinds of parameter:  `typed' and `untyped'.
Macros can have neither, either, or both.  Typed parameters
will be specified like this:
`[point p, path q, focus f]'
whereas untyped parameters will be specified like this:
`(a, b, c)'.

Typed parameters will make it possible to pass `expressions'
of the proper type as arguments when a macro is called,
while untyped arguments will have to be `symbolic tokens'.
On the other hand, it should be possible to use untyped
parameters for writing "generic" macros where the macros
will be able to operate on objects of different types.

I think that `strings', either passed to the macro as typed or untyped
arguments, and to `scantokens' within the macro, should
probably be able to serve the function of `text' arguments
to Metafont's macros.

It's already possible to use macros without arguments,
however I've left some debugging output turned on.  I am
about to start working on the routines for collecting and
processing the `parameters' for `macro definitions' and the
`arguments' for `macro calls'.  Unfortunately, I won't have
much access to computers where I can work on 3DLDF until
next week.

It has been convenient to implement `macros' as variables,
so that it is possible to declare arrays of `macros' and
assign from `macro variables' to `macro variables'.  It is
also possible to declare `macro_vectors', but I have not yet
implemented a way of appending `macros' to `macro_vectors'.
I don't think this will be too difficult, though.

Since `macros' are `variables' anyway, I don't see any
reason to implement `vardefs'.  It may be convenient to
define `vardef' as a synonym for `macro', but I'll have to
think about this.  At the moment, I have no plans to
implement `primarydefs', `secondarydefs', or
`tertiarydefs'.  I think it would be quite difficult, and
I'm not sure whether it would be useful enough to bother
with.  If there are any operators that users really want, it
would probably be easier for me to just add parser rules to
implement them.

If you have any questions, please feel free to ask.

Laurence




reply via email to

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