| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" |
| 2 |
"http://www.w3.org/TR/REC-html40/loose.dtd"> |
| 3 |
|
| 4 |
<HTML> |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
<HEAD> |
| 31 |
<TITLE>2.4 A Review Of FunnelWeb Syntax</TITLE> |
| 32 |
<STYLE TYPE="text/css"> <!-- A {text-decoration: none} // --> </STYLE> |
| 33 |
</HEAD> |
| 34 |
<BODY BACKGROUND="binary/background.gif" |
| 35 |
BGCOLOR="#FFFFFF" |
| 36 |
TEXT="#000000" |
| 37 |
VLINK="#660000" |
| 38 |
LINK="#FF0000" |
| 39 |
ALINK="#CC0000"> |
| 40 |
|
| 41 |
<TABLE WIDTH="490"> |
| 42 |
<TR> |
| 43 |
<TD WIDTH="130" VALIGN="top"> |
| 44 |
<IMG SRC="binary/d_clear.gif" ALT="" WIDTH="130" HEIGHT="1"><BR> |
| 45 |
|
| 46 |
<FONT SIZE="2"> |
| 47 |
<BR> |
| 48 |
|
| 49 |
<A HREF="http://www.ross.net/" |
| 50 |
TARGET="rosshome" |
| 51 |
onClick="window.open('','rosshome','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 52 |
> |
| 53 |
<IMG SRC="binary/rossnet_logo.gif" |
| 54 |
WIDTH="64" HEIGHT="32" |
| 55 |
BORDER="0" ALT="RossNet" |
| 56 |
HSPACE="0" VSPACE="1"></A><BR> |
| 57 |
<BR> |
| 58 |
|
| 59 |
<A HREF="../index.shtml" |
| 60 |
TARGET="funnelweb" |
| 61 |
onClick="window.open('','funnelweb','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 62 |
> |
| 63 |
<IMG SRC="binary/linklogo.gif" |
| 64 |
WIDTH="64" HEIGHT="32" |
| 65 |
BORDER="0" ALT="FunnelWeb" |
| 66 |
HSPACE="0" VSPACE="1"></A><BR> |
| 67 |
<BR> |
| 68 |
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD BGCOLOR="#000000"> |
| 69 |
<A HREF="../reference/index.html" |
| 70 |
TARGET="funnelwebreference" |
| 71 |
onClick="window.open('','funnelwebreference','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 72 |
><FONT COLOR="#FFFFFF"><B>Reference</B></FONT></A><BR> |
| 73 |
<BR> |
| 74 |
<A HREF="../tutorial/index.html" |
| 75 |
TARGET="funnelwebtutorial" |
| 76 |
onClick="window.open('','funnelwebtutorial','location,status,menubar,scrollbars,resizable',false).focus(); return true;" |
| 77 |
><FONT COLOR="#FFFFFF"><B>Tutorial</B></FONT></A><BR> |
| 78 |
<BR> |
| 79 |
<A HREF="index.html"><FONT COLOR="#FFFFFF"><B>Developer</B></FONT></A><BR> |
| 80 |
<A HREF="compile.html"><FONT COLOR="#FFFFFF">1 Compile</FONT></A><BR> |
| 81 |
<A HREF="design.html"><FONT COLOR="#FFFFFF">2 Design</FONT></A><BR> |
| 82 |
<A HREF="implement.html"><FONT COLOR="#FFFFFF">3 Implement</FONT></A><BR> |
| 83 |
<A HREF="modify.html"><FONT COLOR="#FFFFFF">4 Modify</FONT></A><BR> |
| 84 |
<A HREF="misc.html"><FONT COLOR="#FFFFFF">5 Misc</FONT></A><BR> |
| 85 |
<A HREF="gpl.html"><FONT COLOR="#FFFFFF">6 Licence</FONT></A><BR> |
| 86 |
|
| 87 |
<BR> |
| 88 |
<A HREF="search.html"><FONT COLOR="#FFFFFF"><B>SEARCH</B></FONT></A><BR> |
| 89 |
</FONT> |
| 90 |
</TD></TR></TABLE> |
| 91 |
|
| 92 |
|
| 93 |
</TD> |
| 94 |
<TD WIDTH="360" VALIGN="top"> |
| 95 |
<FONT SIZE="3"> |
| 96 |
|
| 97 |
|
| 98 |
<A HREF="index.html"><IMG SRC="binary/title.gif" |
| 99 |
WIDTH="316" HEIGHT="24" |
| 100 |
BORDER="0" ALT="FunnelWeb Developer Manual" |
| 101 |
HSPACE="0" VSPACE="0"></A> |
| 102 |
<P><FONT SIZE="5">2.4 A Review Of FunnelWeb Syntax</FONT><BR> |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
<P>One of the disadvantages of FunnelWeb is its |
| 107 |
clumsy macro definition and calling syntax. Compared to |
| 108 |
(say) the C preprocessor, FunnelWeb's macro call syntax is |
| 109 |
like a freight train in a china shop. Unfortunately, all |
| 110 |
attempts to convert this syntax to something more elgant |
| 111 |
have failed, because the existing syntax is the simplest |
| 112 |
from a conceptual point of view and is the least likely |
| 113 |
to cause semantic confusion. This page discusses and |
| 114 |
justifies the FunnelWeb syntax. |
| 115 |
|
| 116 |
<P><BR><FONT SIZE="4"><STRONG>Macro Definition Syntax</STRONG></FONT><BR> |
| 117 |
|
| 118 |
|
| 119 |
<P>FunnelWeb's macro definition syntax results in |
| 120 |
definitions that look like this: |
| 121 |
|
| 122 |
<P><PRE> |
| 123 |
@$@<Put out the cat@>==@{@- |
| 124 |
Open the door |
| 125 |
Say out |
| 126 |
Close the door@} |
| 127 |
</PRE> |
| 128 |
|
| 129 |
<P>Here's why this syntax was chosen: |
| 130 |
|
| 131 |
<P><BLOCKQUOTE><B>Dollars:</B> The <SAMP>@$</SAMP> is necessary to cue a |
| 132 |
definition. Without it, the definition might somehow be |
| 133 |
mistaken for an invocation.</BLOCKQUOTE> |
| 134 |
|
| 135 |
<P><BLOCKQUOTE><B>Name delimiters:</B> The <SAMP>@<</SAMP> and |
| 136 |
<SAMP>@></SAMP> are required to delimit the name and to |
| 137 |
resonate syntactically with macro calls.</BLOCKQUOTE> |
| 138 |
|
| 139 |
<P><BLOCKQUOTE><B>Content delimiters:</B> The <SAMP>@{</SAMP> and |
| 140 |
<SAMP>@}</SAMP> delimit the content of the macro.</BLOCKQUOTE> |
| 141 |
|
| 142 |
<P><BLOCKQUOTE><B>EOL suppressor:</B> The <SAMP>@-</SAMP> is a |
| 143 |
result of the simplifying rule that the content of a macro |
| 144 |
is "exactly the text between the |
| 145 |
<SAMP>@{</SAMP> and <SAMP>@}</SAMP>."</BLOCKQUOTE> |
| 146 |
|
| 147 |
<P>The only real target for a syntax purge the |
| 148 |
"<TT>==</TT>" which is optional anyway. |
| 149 |
|
| 150 |
<P>An alternative minimalist approach to macro definitions |
| 151 |
is: |
| 152 |
|
| 153 |
<P><PRE> |
| 154 |
@<Put out the cat@> |
| 155 |
Open the door |
| 156 |
Say out |
| 157 |
Close the door@} |
| 158 |
</PRE> |
| 159 |
|
| 160 |
<P>but this is too dangerous for my tastes as there |
| 161 |
is no syntax surrounding the name of the macro to |
| 162 |
indicate that it is a macro definition and not a macro |
| 163 |
call. |
| 164 |
|
| 165 |
<P><BR><FONT SIZE="4"><STRONG>Parameterized Macro Definition Syntax</STRONG></FONT><BR> |
| 166 |
|
| 167 |
<P>The definitions of parameterized macros are even messier |
| 168 |
than the normal definitions. |
| 169 |
|
| 170 |
<P><PRE> |
| 171 |
@$@<Put out the cat@>@(@3@)==@{@- |
| 172 |
Open the door |
| 173 |
Say out |
| 174 |
Close the door@} |
| 175 |
</PRE> |
| 176 |
|
| 177 |
This is messy, but the "natural" alternative is even worse: |
| 178 |
|
| 179 |
<P><PRE> |
| 180 |
@$@<Put out the cat@>@(@1@,@2@,@3@)==@{@- |
| 181 |
Open the door |
| 182 |
Say out |
| 183 |
Close the door@} |
| 184 |
</PRE> |
| 185 |
|
| 186 |
<P>Given that the parameters don't have names, it seems cleaner |
| 187 |
just to specify the number of parameters. |
| 188 |
pecifying the number of parameters seems sensible. |
| 189 |
|
| 190 |
<P><BR><FONT SIZE="4"><STRONG>Macro Call Syntax</STRONG></FONT><BR> |
| 191 |
|
| 192 |
|
| 193 |
<P>Here are some syntaxes that were considered for |
| 194 |
FunnelWeb macro calls. |
| 195 |
|
| 196 |
<P> |
| 197 |
<PRE> |
| 198 |
Open the door |
| 199 |
@<Say Out@> @! Current style. |
| 200 |
Close the door |
| 201 |
|
| 202 |
Open the door |
| 203 |
@<Say out>@ |
| 204 |
Close the door |
| 205 |
|
| 206 |
Open the door |
| 207 |
@"Say out@" |
| 208 |
Close the door |
| 209 |
|
| 210 |
Open the door |
| 211 |
@(Say out@) |
| 212 |
Close the door |
| 213 |
|
| 214 |
Open the door |
| 215 |
@<Say out> |
| 216 |
Close the door |
| 217 |
</PRE> |
| 218 |
|
| 219 |
<P>Of these, the first was chosen. |
| 220 |
|
| 221 |
<P><BR><FONT SIZE="4"><STRONG>Parameterized Macro Call Syntax</STRONG></FONT><BR> |
| 222 |
|
| 223 |
|
| 224 |
<P>FunnelWeb V1 provided a messy parameterized macro |
| 225 |
call syntax: |
| 226 |
|
| 227 |
<P><PRE> |
| 228 |
@<Say Out@>@(@"firstparam@" @, |
| 229 |
@"Secondparam@" @, |
| 230 |
@"thirdparam@" @) |
| 231 |
</PRE> |
| 232 |
|
| 233 |
<P>This syntax was cleaned up considerably in V3.0 by making |
| 234 |
the <SAMP>@"</SAMP> symbols optional: |
| 235 |
|
| 236 |
<P><PRE> |
| 237 |
@<Say Out@>@(firstparam@,@- |
| 238 |
Secondparam@,thirdparam@) |
| 239 |
</PRE> |
| 240 |
|
| 241 |
|
| 242 |
<P> |
| 243 |
<TABLE WIDTH="100%"> |
| 244 |
<TR> |
| 245 |
<TD ALIGN="left" VALIGN="bottom"><A HREF="design_indentation.html"><IMG SRC="binary/fw_left.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Prev"></A></TD> |
| 246 |
<TD ALIGN="center" VALIGN="bottom"><A HREF="design.html"><IMG SRC="binary/fw_up.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Up"></A></TD> |
| 247 |
<TD ALIGN="right" VALIGN="bottom"><A HREF="design_structure.html"><IMG SRC="binary/fw_right.gif" HEIGHT="32" WIDTH="32" BORDER="0" ALT="Next"></A></TD> |
| 248 |
</TR> |
| 249 |
</TABLE> |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
<P> |
| 254 |
<HR> |
| 255 |
<FONT SIZE="2"> |
| 256 |
<A HREF="mailto:[email protected]">Webmaster</A> |
| 257 |
<A HREF="copyright.html">Copyright © Ross N. Williams 1992,1999. All rights reserved.</A><BR> |
| 258 |
</FONT> |
| 259 |
|
| 260 |
</FONT> |
| 261 |
</TD> |
| 262 |
</TR> |
| 263 |
</TABLE> |
| 264 |
|
| 265 |
|
| 266 |
</BODY> |
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
</HTML> |