mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
Wrote about list syntax in gf-history.html
This commit is contained in:
@@ -19,6 +19,54 @@ display syntax trees graphically. Like <tt>vg</tt>, this command uses
|
|||||||
GraphViz and Ghostview. The foremost use is to pipe the parser to this
|
GraphViz and Ghostview. The foremost use is to pipe the parser to this
|
||||||
command.
|
command.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
17/6 (BB) There is now support for lists in GF abstract syntax.
|
||||||
|
A list category is declared as:
|
||||||
|
<pre>
|
||||||
|
cat [C]
|
||||||
|
</pre>
|
||||||
|
or
|
||||||
|
<pre>
|
||||||
|
cat [C]{n}
|
||||||
|
</pre>
|
||||||
|
where <tt>C</tt> is a category and <tt>n</tt> is a non-negative integer.
|
||||||
|
<tt>cat [C]</tt> is equivalent to <tt>cat [C]{0}</tt>. List category
|
||||||
|
syntax can be used whereever categories are used.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<tt>cat [C]{n}</tt> is equivalent to the declarations:
|
||||||
|
<pre>
|
||||||
|
cat ListC
|
||||||
|
fun BaseC : C^n -> ListC
|
||||||
|
fun ConsC : C -> ListC -> ListC
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
where <tt>C^0 -> X</tt> means <tt>X</tt>, and <tt>C^m</tt> (where
|
||||||
|
m > 0) means <tt>C -> C^(m-1)</tt>.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
A lincat declaration on the form:
|
||||||
|
<pre>
|
||||||
|
lincat [C] = T
|
||||||
|
</pre>
|
||||||
|
is equivalent to
|
||||||
|
<pre>
|
||||||
|
lincat ListC = T
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
The linearizations of the list constructors are written
|
||||||
|
just like they would be if the function declarations above
|
||||||
|
had been made manually, e.g.:
|
||||||
|
<pre>
|
||||||
|
lin BaseC x_1 ... x_n = t
|
||||||
|
lin ConsC x xs = t'
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
10/6 (AR) Preprocessor of <tt>.gfe</tt> files can now be performed as part of
|
10/6 (AR) Preprocessor of <tt>.gfe</tt> files can now be performed as part of
|
||||||
|
|||||||
Reference in New Issue
Block a user