Thread View: comp.specification.z
2 messages
2 total messages
Started by Martin Carstensen
Thu, 23 Jul 1992 17:26
concrete syntax and fuzz
Author: Martin Carstensen
Date: Thu, 23 Jul 1992 17:26
Date: Thu, 23 Jul 1992 17:26
45 lines
1777 bytes
1777 bytes
The concrete syntax of fuzz differs slightly from the one LaTeX produces
from specifications (e.g. fuzz syntax contains the string "\forall"
where LaTeX produces the quantor symbol itself, schemas are more
complicated examples).
These differences can be utilized to some extent. If you want the
(unparenthesized) argument to a function written as subscript you can
get this by defining:
\newcommand{\f}[1]{f_{#1}}
\begin{gendef}[INDEX]
\f : INDEX \fun \nat \pfun \nat
\end{gendef}
Recently I tried to define strings like this:
\begin{zed}
LETTER ::= a|b|c|d \\
STRING ::= string \ldata \seq LETTER \rdata
\end{zed}
Now I'm looking for a way to tell LaTeX what strings shall look like
and which will be accepted by fuzz. The following approach would be
treated properly by fuzz, but the LaTeX definition does only do half
of the job.
\newcommand{\str}[1]{"#1"}
%%\begin{zed}
%%\str == string
%%\end{zed}
\begin{axdef}
s: STRING
\where
s = string \langle a, b \rangle \\
s = \str {\langle a, b \rangle}
\end{axdef}
Any idea?
--
+------------------------------------------------------------------------
| Martin Carstensen, Koblenz University cash@infko.uni-koblenz.de
| Department of Computer Science Voice: +49 261 9119-423
| Rheinau 3-4, D-5400 Koblenz, Germany Fax: +49 261 9119-499
Re: concrete syntax and fuzz
Author: Brendan Mahony
Date: Fri, 24 Jul 1992 01:44
Date: Fri, 24 Jul 1992 01:44
59 lines
2609 bytes
2609 bytes
In <9207231534.AA00732@auric> cash@auric.uni-koblenz.de (Martin Carstensen) writes:
| The concrete syntax of fuzz differs slightly from the one LaTeX produces
| from specifications (e.g. fuzz syntax contains the string "\forall"
| where LaTeX produces the quantor symbol itself, schemas are more
| complicated examples).
| Recently I tried to define strings like this:
| \begin{zed}
| LETTER ::= a|b|c|d \\
| STRING ::= string \ldata \seq LETTER \rdata
| \end{zed}
|
| Now I'm looking for a way to tell LaTeX what strings shall look like
| and which will be accepted by fuzz. The following approach would be
| treated properly by fuzz, but the LaTeX definition does only do half
| of the job.
| \newcommand{\str}[1]{"#1"}
| %%\begin{zed}
| %%\str == string
| %%\end{zed}
| \begin{axdef}
| s: STRING
| \where
| s = string \langle a, b \rangle \\
| s = \str {\langle a, b \rangle}
| \end{axdef}
I am not sure your solution works at all for the new version of fuzz, at
least we have had troubles with spurious {..} pairs.
Anyway, you need to appeal to a little TeX (i.e. use \def rather than
\newcommand). In general if you want to produce a novel concrete syntax
for a function application use a TeX definition like
\def\f(#1){...}
Now you can write \f(arg) in your Z, get fuzz to accept it, and get
LaTeX to print it any old how. (This idea was suggested by Mike Spivey)
I your case you need to redefine the TeX output of \langle .. \rangle.
Try this:
\def\str(#1){\def\langle{\mathopen{\mbox{``}}}\def\langle{\mathopen{\mbox{``}}}#1}
You list now appears within quotes rather than < .. > brackets.
I am not as clear on how to get rid of the commas. Some trick with a
\mathchardef or \mathcode I suppose. I don't think you can trick fuzz
into accepting some character other than the comma. Find a copy of the
TeXbook.
--
When soldiers form lines or hollow squares, you call it reason.
When wild geese in flight take the form of a letter V, you say instinct.
When the homogeneous atoms of a mineral arrange themselves into shapes
mathematically perfect you have nothing to say. You have not even invented a name to conceal your heroic unreason."
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads