diff options
| author | aarne <aarne@chalmers.se> | 2010-12-22 14:08:42 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2010-12-22 14:08:42 +0000 |
| commit | ce15ec7b787479ca4c7295863ea7fa5cfdd16755 (patch) | |
| tree | f47d9227ab535781d44d00e6232b8c62902167df | |
| parent | fb722fe8e2cedee3b42d7fb0c9da61ace74f3e22 (diff) | |
moved parts of doc to deprecated/doc
| -rw-r--r-- | deprecated/Resource-HOWTO.html (renamed from doc/Resource-HOWTO.html) | 0 | ||||
| -rw-r--r-- | deprecated/Resource-HOWTO.txt (renamed from doc/Resource-HOWTO.txt) | 0 | ||||
| -rw-r--r-- | deprecated/Syntax.png (renamed from doc/Syntax.png) | bin | 104604 -> 104604 bytes | |||
| -rw-r--r-- | deprecated/doc/2341.html (renamed from doc/2341.html) | 0 | ||||
| -rw-r--r-- | deprecated/doc/DocGF.pdf (renamed from doc/DocGF.pdf) | bin | 56906 -> 56906 bytes | |||
| -rw-r--r-- | deprecated/doc/DocGF.tex (renamed from doc/DocGF.tex) | 0 | ||||
| -rw-r--r-- | deprecated/doc/German.png (renamed from doc/German.png) | bin | 21000 -> 21000 bytes | |||
| -rw-r--r-- | deprecated/doc/Grammar.dot (renamed from doc/Grammar.dot) | 0 | ||||
| -rw-r--r-- | deprecated/doc/Grammar.png (renamed from doc/Grammar.png) | bin | 78790 -> 78790 bytes | |||
| -rw-r--r-- | deprecated/doc/TODO (renamed from doc/TODO) | 0 | ||||
| -rw-r--r-- | deprecated/doc/compiling-gf.txt (renamed from doc/compiling-gf.txt) | 0 | ||||
| -rw-r--r-- | deprecated/doc/eu-langs.dot (renamed from doc/eu-langs.dot) | 0 | ||||
| -rw-r--r-- | deprecated/doc/eu-langs.png (renamed from doc/eu-langs.png) | bin | 85484 -> 85484 bytes | |||
| -rw-r--r-- | deprecated/doc/food-translet.png (renamed from doc/food-translet.png) | bin | 22916 -> 22916 bytes | |||
| -rw-r--r-- | deprecated/doc/food1.png (renamed from doc/food1.png) | bin | 22805 -> 22805 bytes | |||
| -rw-r--r-- | deprecated/doc/food2.png (renamed from doc/food2.png) | bin | 31506 -> 31506 bytes | |||
| -rw-r--r-- | deprecated/doc/gf-compiler.dot (renamed from doc/gf-compiler.dot) | 0 | ||||
| -rw-r--r-- | deprecated/doc/gf-compiler.png (renamed from doc/gf-compiler.png) | bin | 27451 -> 27451 bytes | |||
| -rw-r--r-- | deprecated/doc/gf-formalism.html (renamed from doc/gf-formalism.html) | 0 | ||||
| -rw-r--r-- | deprecated/doc/gf-formalism.txt (renamed from doc/gf-formalism.txt) | 0 | ||||
| -rw-r--r-- | deprecated/doc/gf-ideas.html (renamed from doc/gf-ideas.html) | 0 | ||||
| -rw-r--r-- | deprecated/doc/gf-ideas.txt (renamed from doc/gf-ideas.txt) | 0 | ||||
| -rw-r--r-- | deprecated/doc/gf-statistics.txt (renamed from doc/gf-statistics.txt) | 0 | ||||
| -rw-r--r-- | deprecated/doc/gf-summerschool.txt (renamed from doc/gf-summerschool.txt) | 0 | ||||
| -rw-r--r-- | deprecated/doc/gf3-release.html (renamed from doc/gf3-release.html) | 0 | ||||
| -rw-r--r-- | deprecated/doc/gf3-release.txt (renamed from doc/gf3-release.txt) | 0 | ||||
| -rw-r--r-- | deprecated/doc/school-langs.dot (renamed from doc/school-langs.dot) | 0 | ||||
| -rw-r--r-- | deprecated/doc/school-langs.png (renamed from doc/school-langs.png) | bin | 131704 -> 131704 bytes | |||
| -rw-r--r-- | deprecated/doc/summer-align.png (renamed from doc/summer-align.png) | bin | 449911 -> 449911 bytes | |||
| -rw-r--r-- | deprecated/doc/summer-langs.png (renamed from doc/summer-langs.png) | bin | 1885485 -> 1885485 bytes | |||
| -rw-r--r-- | deprecated/doc/vr.html (renamed from doc/vr.html) | 0 | ||||
| -rw-r--r-- | deprecated/doc/vr.txt (renamed from doc/vr.txt) | 0 | ||||
| -rw-r--r-- | doc/gf-people.html | 27 | ||||
| -rw-r--r-- | doc/gf-quickstart.html | 42 | ||||
| -rw-r--r-- | doc/gf-refman.html | 2 | ||||
| -rw-r--r-- | doc/index.html | 155 | ||||
| -rw-r--r-- | doc/tutorial/10lang-small.png (renamed from doc/10lang-small.png) | bin | 66840 -> 66840 bytes | |||
| -rw-r--r-- | doc/tutorial/categories.png (renamed from doc/categories.png) | bin | 4241 -> 4241 bytes | |||
| -rw-r--r-- | doc/tutorial/food-js.png (renamed from doc/food-js.png) | bin | 19002 -> 19002 bytes | |||
| -rw-r--r-- | doc/tutorial/food-magnet.png (renamed from doc/food-magnet.png) | bin | 98845 -> 98845 bytes | |||
| -rw-r--r-- | doc/tutorial/foodmarket.png (renamed from doc/foodmarket.png) | bin | 2099 -> 2099 bytes | |||
| -rw-r--r-- | doc/tutorial/gf-tutorial.html (renamed from doc/gf-tutorial.html) | 461 | ||||
| -rw-r--r-- | doc/tutorial/gf-tutorial.txt (renamed from doc/gf-tutorial.txt) | 42 | ||||
| -rw-r--r-- | doc/tutorial/iphone.jpg (renamed from doc/iphone.jpg) | bin | 17150 -> 17150 bytes | |||
| -rw-r--r-- | doc/tutorial/mytree.png (renamed from doc/mytree.png) | bin | 2230 -> 2230 bytes | |||
| -rw-r--r-- | index.html | 8 |
46 files changed, 81 insertions, 656 deletions
diff --git a/doc/Resource-HOWTO.html b/deprecated/Resource-HOWTO.html index ce2c15137..ce2c15137 100644 --- a/doc/Resource-HOWTO.html +++ b/deprecated/Resource-HOWTO.html diff --git a/doc/Resource-HOWTO.txt b/deprecated/Resource-HOWTO.txt index 8e50974a7..8e50974a7 100644 --- a/doc/Resource-HOWTO.txt +++ b/deprecated/Resource-HOWTO.txt diff --git a/doc/Syntax.png b/deprecated/Syntax.png Binary files differindex f36c098f6..f36c098f6 100644 --- a/doc/Syntax.png +++ b/deprecated/Syntax.png diff --git a/doc/2341.html b/deprecated/doc/2341.html index ff3e9644d..ff3e9644d 100644 --- a/doc/2341.html +++ b/deprecated/doc/2341.html diff --git a/doc/DocGF.pdf b/deprecated/doc/DocGF.pdf Binary files differindex 27e4262db..27e4262db 100644 --- a/doc/DocGF.pdf +++ b/deprecated/doc/DocGF.pdf diff --git a/doc/DocGF.tex b/deprecated/doc/DocGF.tex index 6388d3548..6388d3548 100644 --- a/doc/DocGF.tex +++ b/deprecated/doc/DocGF.tex diff --git a/doc/German.png b/deprecated/doc/German.png Binary files differindex 7c6303897..7c6303897 100644 --- a/doc/German.png +++ b/deprecated/doc/German.png diff --git a/doc/Grammar.dot b/deprecated/doc/Grammar.dot index cb2998eb3..cb2998eb3 100644 --- a/doc/Grammar.dot +++ b/deprecated/doc/Grammar.dot diff --git a/doc/Grammar.png b/deprecated/doc/Grammar.png Binary files differindex ada2847d7..ada2847d7 100644 --- a/doc/Grammar.png +++ b/deprecated/doc/Grammar.png diff --git a/doc/TODO b/deprecated/doc/TODO index c92f4c8fa..c92f4c8fa 100644 --- a/doc/TODO +++ b/deprecated/doc/TODO diff --git a/doc/compiling-gf.txt b/deprecated/doc/compiling-gf.txt index 9e438f40f..9e438f40f 100644 --- a/doc/compiling-gf.txt +++ b/deprecated/doc/compiling-gf.txt diff --git a/doc/eu-langs.dot b/deprecated/doc/eu-langs.dot index 115ce0040..115ce0040 100644 --- a/doc/eu-langs.dot +++ b/deprecated/doc/eu-langs.dot diff --git a/doc/eu-langs.png b/deprecated/doc/eu-langs.png Binary files differindex 8c46a19db..8c46a19db 100644 --- a/doc/eu-langs.png +++ b/deprecated/doc/eu-langs.png diff --git a/doc/food-translet.png b/deprecated/doc/food-translet.png Binary files differindex dd622a4bf..dd622a4bf 100644 --- a/doc/food-translet.png +++ b/deprecated/doc/food-translet.png diff --git a/doc/food1.png b/deprecated/doc/food1.png Binary files differindex 767069dab..767069dab 100644 --- a/doc/food1.png +++ b/deprecated/doc/food1.png diff --git a/doc/food2.png b/deprecated/doc/food2.png Binary files differindex b36a01b22..b36a01b22 100644 --- a/doc/food2.png +++ b/deprecated/doc/food2.png diff --git a/doc/gf-compiler.dot b/deprecated/doc/gf-compiler.dot index f8ce1aaae..f8ce1aaae 100644 --- a/doc/gf-compiler.dot +++ b/deprecated/doc/gf-compiler.dot diff --git a/doc/gf-compiler.png b/deprecated/doc/gf-compiler.png Binary files differindex 6949c37b5..6949c37b5 100644 --- a/doc/gf-compiler.png +++ b/deprecated/doc/gf-compiler.png diff --git a/doc/gf-formalism.html b/deprecated/doc/gf-formalism.html index 52d9256aa..52d9256aa 100644 --- a/doc/gf-formalism.html +++ b/deprecated/doc/gf-formalism.html diff --git a/doc/gf-formalism.txt b/deprecated/doc/gf-formalism.txt index 3b6963d11..3b6963d11 100644 --- a/doc/gf-formalism.txt +++ b/deprecated/doc/gf-formalism.txt diff --git a/doc/gf-ideas.html b/deprecated/doc/gf-ideas.html index 8119740fa..8119740fa 100644 --- a/doc/gf-ideas.html +++ b/deprecated/doc/gf-ideas.html diff --git a/doc/gf-ideas.txt b/deprecated/doc/gf-ideas.txt index 3f62196b9..3f62196b9 100644 --- a/doc/gf-ideas.txt +++ b/deprecated/doc/gf-ideas.txt diff --git a/doc/gf-statistics.txt b/deprecated/doc/gf-statistics.txt index 499ad7d09..499ad7d09 100644 --- a/doc/gf-statistics.txt +++ b/deprecated/doc/gf-statistics.txt diff --git a/doc/gf-summerschool.txt b/deprecated/doc/gf-summerschool.txt index 0acf9177d..0acf9177d 100644 --- a/doc/gf-summerschool.txt +++ b/deprecated/doc/gf-summerschool.txt diff --git a/doc/gf3-release.html b/deprecated/doc/gf3-release.html index 75557c94a..75557c94a 100644 --- a/doc/gf3-release.html +++ b/deprecated/doc/gf3-release.html diff --git a/doc/gf3-release.txt b/deprecated/doc/gf3-release.txt index 631752c90..631752c90 100644 --- a/doc/gf3-release.txt +++ b/deprecated/doc/gf3-release.txt diff --git a/doc/school-langs.dot b/deprecated/doc/school-langs.dot index 88e0a9c96..88e0a9c96 100644 --- a/doc/school-langs.dot +++ b/deprecated/doc/school-langs.dot diff --git a/doc/school-langs.png b/deprecated/doc/school-langs.png Binary files differindex 7230e0bff..7230e0bff 100644 --- a/doc/school-langs.png +++ b/deprecated/doc/school-langs.png diff --git a/doc/summer-align.png b/deprecated/doc/summer-align.png Binary files differindex 796754408..796754408 100644 --- a/doc/summer-align.png +++ b/deprecated/doc/summer-align.png diff --git a/doc/summer-langs.png b/deprecated/doc/summer-langs.png Binary files differindex 729af722a..729af722a 100644 --- a/doc/summer-langs.png +++ b/deprecated/doc/summer-langs.png diff --git a/doc/vr.html b/deprecated/doc/vr.html index e5dee1885..e5dee1885 100644 --- a/doc/vr.html +++ b/deprecated/doc/vr.html diff --git a/doc/vr.txt b/deprecated/doc/vr.txt index 9b5045978..9b5045978 100644 --- a/doc/vr.txt +++ b/deprecated/doc/vr.txt diff --git a/doc/gf-people.html b/doc/gf-people.html index 690084d3c..bc09412d0 100644 --- a/doc/gf-people.html +++ b/doc/gf-people.html @@ -13,12 +13,13 @@ </center> -Most of the code is by -<a "http://www.chalmers.se/cse/EN/organization/divisions/computing-science/people/angelov-krasimir">Krasimir Angelov</a>, -<a href="http://www.cs.chalmers.se/~bringert">Björn Bringert</a>, +The current developers and maintainers are +<a href="http://www.chalmers.se/cse/EN/organization/divisions/computing-science/people/angelov-krasimir">Krasimir Angelov</a>, +<a href="http://www.cs.chalmers.se/~hallgren">Thomas Hallgren</a>, and -<a href="http://www.cs.chalmers.se/~aarne">Aarne Ranta</a>. Bug reports should be -posted via the <a href="http://trac.haskell.org/gf/">GF bug tracker</a>. +<a href="http://www.cse.chalmers.se/~aarne">Aarne Ranta</a>. Bug reports should be +posted via the +<a href="http://code.google.com/p/grammatical-framework/issues/list">GF bug tracker</a>. <p> @@ -27,19 +28,23 @@ Also the following people have contributed code to some of the versions: <p> -Håkan Burden (Chalmers) +Grégoire Détrez (University of Gothenburg) +<br> +Ramona Enache (University of Gothenburg) +<br> +<a href="http://www.cse.chalmers.se/alumni/bringert">Björn Bringert</a> (University of Gothenburg) +<br> +Håkan Burden (University of Gothenburg) <br> Hans-Joachim Daniels (Karlsruhe) <br> <a href="http://www.cs.chalmers.se/~markus">Markus Forsberg</a> (Chalmers) <br> -<a href="http://www.cs.chalmers.se/~hallgren">Thomas Hallgren</a> (Chalmers) -<br> -<a href="http://www.cs.chalmers.se/~krijo">Kristofer Johannisson</a> (Chalmers) +<a href="http://www.cs.chalmers.se/~krijo">Kristofer Johannisson</a> (University of Gothenburg) <br> -<a href="http://www.cs.chalmers.se/~janna">Janna Khegai</a> (Chalmers) +<a href="http://www.cs.chalmers.se/~janna">Janna Khegai</a> (Chalmers) <br> -<a href="http://www.cs.chalmers.se/~peb">Peter Ljunglöf</a> (Chalmers) +<a href="http://www.cs.chalmers.se/~peb">Peter Ljunglöf</a> (University of Gothenburg) <br> Petri Mäenpää (Nokia) diff --git a/doc/gf-quickstart.html b/doc/gf-quickstart.html index 7a6971953..cd508d474 100644 --- a/doc/gf-quickstart.html +++ b/doc/gf-quickstart.html @@ -9,7 +9,7 @@ <p> Aarne Ranta <p> -3 September, 2007 +22 December 2010 (3 September, 2007) <p> @@ -20,7 +20,7 @@ Aarne Ranta This Quick Start shows two examples of how GF can be used. We assume that you have downloaded and installed GF, so that the command <tt>gf</tt> works for you. See download and install -instructions <a href="http://digitalgrammars.com/gf/download/">here</a>. +instructions <a href="../download/index.html">here</a>. @@ -61,39 +61,11 @@ and start GF again with the same command. Now you can even translate <i>this bread is very Italian</i>. </ol> To lear more on GF commands and -grammar development, go to the -<a href="tutorial/gf-tutorial2.html">New Grammarian's Tutorial</a>. +grammar development, go to the one of the tutorials: +<ul> +<li> <a href="tutorial/gf-tutorial.html">GF Tutorial</a>: older, more programmer-oriented +<li> <a href="gf-lrec-2010.pdf">GF Resource Tutorial</a>: newer, more linguist-oriented +</ul> - -<h2>Multilingual authoring</h2> - -This demo also requires the GUI package, which makes the command -<tt>jgf</tt> work for you. -<ol> -<li> Download the file <a href="../examples/letter/Letter.gfcm"><tt>Letter.gfcm</tt></a>. -<li> Start the GF editor by the command -<pre> - gfeditor Letter.gfcm -</pre> -<li> When the editor window is open, select "Letter" from the "New" menu. -<li> Push the button "Random" in the lower end of the window. -<li> Move the pointer to some place in the text, e.g. to the first word (in any - of the languages), and click. The first word should now be highlighted and - a number of alternatives appear in the lower window part (a similar situation - is shown in the picture below). -<li> Double-click at some of the alternatives marked "ch ..." and observe how - the text changes in each of the languages. -</ol> -See the <a href="http://www.cs.chalmers.se/~aarne/GF2.0/doc/javaGUImanual/javaGUImanual.htm">Editor User Manual</a> -for more information on how to use the -editor. To change the grammars, you should not edit <tt>Letter.gfcm</tt>, -which is low-level code generated by the GF grammar compiler. Instead, you -can edit the files in <tt>examples/letter</tt> in the GF grammar package, -and compile by using the script <tt>mkLetter.gfs</tt> in the same package. - -<p> - -<img src="quick-editor.gif"> - </body></html> diff --git a/doc/gf-refman.html b/doc/gf-refman.html index 104f644c7..188a063a8 100644 --- a/doc/gf-refman.html +++ b/doc/gf-refman.html @@ -106,7 +106,7 @@ This document is not an introduction to GF; such introduction can be found in the GF tutorial available on line on the GF web page, </P> <P> -<A HREF="http://digitalgrammars.com/gf"><CODE>digitalgrammars.com/gf</CODE></A> +<A HREF="http://grammaticalframework.org"><CODE>grammaticalframework.org</CODE></A> </P> <P> This manual covers only the language, not the GF compiler or diff --git a/doc/index.html b/doc/index.html index e4aa842ff..f6bbf7f1a 100644 --- a/doc/index.html +++ b/doc/index.html @@ -13,28 +13,20 @@ <h1>Grammatical Framework Documents</h1> </center> -<b>Top-3 documents</b>: -<a href="gf-tutorial.html">Tutorial</a> +<b>Top-5 documents</b>: -| - -<a href="gf-refman.html">ReferenceManual</a> - -| - -<a href="../lib/resource/doc/synopsis.html">LibrarySynopsis</a> +<a href="gf-quickstart.html">Quick start instruction</a>. +<a href="tutorial/gf-tutorial.html">Old Tutorial</a>, application-oriented. -<h2>Tutorials</h2> +<a href="gf-lrec-2010.pdf">New Tutorial</a>, linguistics-oriented. -<a href="gf-quickstart.html">Quick start instruction</a>. +<a href="gf-refman.html">ReferenceManual</a>. -<p> +<a href="../lib/resource/doc/synopsis.html">LibrarySynopsis</a>. -<a href="gf-tutorial.html">GF Tutorial</a>, -Now up-to-date for GF version 2.9. Covers all of GF. @@ -49,144 +41,13 @@ in a summary format. <a href="gf-refman.html">GF Reference Manual</a>. A full-scale reference manual of the GF language. -<p> - -<a href="gf-manual.html"> -User Manual</a> explaining the GF user interfaces and command language (slightly -outdated). - -<p> - -<a href="../../GF2.0/doc/javaGUImanual/javaGUImanual.htm">Editor User Manual</a> -on editing in the Java interface. - -<p> - -<a href="gf-compiler.png">Chart of GF grammar compiler phases</a>. - - - -<h2>Grammar library documentation</h2> - -<a href="gf-tutorial.html#chapfive">Resource Grammar Tutorial Chapter</a>. - -<p> - -<a href="../lib/resource/doc/synopsis.html">Resource Grammar Synopsis</a> -for library users. With APIs and use examples. - -<p> - -<a href="../lib/resource/doc/Resource-HOWTO.html"> -Resource Grammar HOWTO</a> -for library authors. - - - - -<h2>Embedding GF grammars in computer programs</h2> - -<a href="gf-tutorial.html#chapeight">Embedded Grammar Tutorial Chapter</a>. - -<p> - -<a href="http://www.cs.chalmers.se/~bringert/gf/gf-java.html"> -Embedded GF Interpreter</a> manual for using GF grammars in Java programs. - -<p> - -<a href="http://www.cs.chalmers.se/~aarne/GF/src/GF/GFCC/API.hs"> -Embedded GF API</a> for using GF grammars in Haskell programs. - -<p> - -<a href="http://www.ling.gu.se/~peb/index.cgi/Software"> -MCFG/GF library for Prolog</a>, -for using GF grammars in Prolog programs. - - - -<h2>Theoretical studies</h2> - -<a href="http://www.cs.chalmers.se/~aarne/articles/gf-jfp.ps.gz"> -Grammatical Framework: A Type-Theoretical -Grammar Formalism</a> (ps.gz). Theoretical paper on GF by A. Ranta. A later -version appeared -in <i>The Journal of Functional Programming</i>, vol. 14:2. 2004, pp. 145-189. -The standard reference on GF. - -<p> - -<a href="http://www.ling.gu.se/~peb/pubs/Ljunglof-2004a.pdf"> -Expressivity and Complexity of the Grammatical Framework</a>, -PhD Thesis by -<a href="http://www.ling.gu.se/~peb">Peter Ljunglöf</a>. - - - -<h2>Introductory talks</h2> - -<a href="http://www.cs.chalmers.se/~aarne/GF2.0/doc/short/gf-short.html"> -GF in 25 Minutes</a> - overview for computer science audience. - -<p> - - -<a href="http://www.cs.chalmers.se/~aarne/slides/gf-rocquencourt.pdf"> -Slides on GF theory and implementation</a> given -at INRIA Rocquencourt in December 2003. - -<p> - -<a -href="http://www.cs.chalmers.se/~aarne/slides/webalt-2005.pdf"> -Slides on example-based grammar writing</a> and a short introduction -to GF grammars. - -<p> - -<a -href="http://www.cs.chalmers.se/~aarne/course-langtech/lectures/lectures.html"> -Course notes on Natural Language Technology</a>, includes -slides on using GF. - - - -<h2>Examples and applications</h2> - -<a href="http://www.cs.chalmers.se/~krijo/thesis/thesisA4.pdf"> -Formal and Informal Software Specifications</a>, -PhD Thesis by -<a href="http://www.cs.chalmers.se/~krijo">Kristofer Johannisson</a>. - - -<p> - -<a href="http://www.dtek.chalmers.se/~d00bring/publ/exjobb/embedded-grammars.pdf"> -Embedded grammars</a>, -Master's thesis by -<a href="http://www.cs.chalmers.se/~bringert/">Björn Bringert</a> - -<p> - -<a -href="http://www.cs.chalmers.se/~bringert/misc/tramdemo.avi">Demo film</a> -of a multimodal dialogue system built with embedded grammars. - - -<p> - -<a href="gfcc.pdf"> -GFCC</a> (pdf): -report on a compiler from a fragment of C to JVM, written in GF. -<h2>More</h2> +<h2>Publications</h2> <a href="gf-bibliography.html"> -Bibliography</a>: -more publications on GF, as well as background literature. +Bibliography</a>: more publications on GF, as well as background literature. </body></html> diff --git a/doc/10lang-small.png b/doc/tutorial/10lang-small.png Binary files differindex 49a3d0a98..49a3d0a98 100644 --- a/doc/10lang-small.png +++ b/doc/tutorial/10lang-small.png diff --git a/doc/categories.png b/doc/tutorial/categories.png Binary files differindex afc5873c5..afc5873c5 100644 --- a/doc/categories.png +++ b/doc/tutorial/categories.png diff --git a/doc/food-js.png b/doc/tutorial/food-js.png Binary files differindex fe579b1a9..fe579b1a9 100644 --- a/doc/food-js.png +++ b/doc/tutorial/food-js.png diff --git a/doc/food-magnet.png b/doc/tutorial/food-magnet.png Binary files differindex 8b137875d..8b137875d 100644 --- a/doc/food-magnet.png +++ b/doc/tutorial/food-magnet.png diff --git a/doc/foodmarket.png b/doc/tutorial/foodmarket.png Binary files differindex 6b0e3fbd7..6b0e3fbd7 100644 --- a/doc/foodmarket.png +++ b/doc/tutorial/foodmarket.png diff --git a/doc/gf-tutorial.html b/doc/tutorial/gf-tutorial.html index 230152005..46b17b96b 100644 --- a/doc/gf-tutorial.html +++ b/doc/tutorial/gf-tutorial.html @@ -8,264 +8,12 @@ <P ALIGN="center"><CENTER><H1>Grammatical Framework Tutorial</H1> <FONT SIZE="4"> <I>Aarne Ranta</I><BR> -Version 3.1.2, November 2008 +December 2010 (November 2008) </FONT></CENTER> -<P></P> -<HR NOSHADE SIZE=1> -<P></P> - <UL> - <LI><A HREF="#toc1">Overview</A> - <UL> - <LI><A HREF="#toc2">Outline</A> - <LI><A HREF="#toc3">Slides</A> - </UL> - <LI><A HREF="#toc4">Lesson 1: Getting Started with GF</A> - <UL> - <LI><A HREF="#toc5">What GF is</A> - <LI><A HREF="#toc6">GF grammars and language processing tasks</A> - <LI><A HREF="#toc7">Getting the GF system</A> - <LI><A HREF="#toc8">Running the GF system</A> - <LI><A HREF="#toc9">A "Hello World" grammar</A> - <UL> - <LI><A HREF="#toc10">The program: abstract syntax and concrete syntaxes</A> - <LI><A HREF="#toc11">Using grammars in the GF system</A> - <LI><A HREF="#toc12">Exercises on the Hello World grammar</A> - </UL> - <LI><A HREF="#toc13">Using grammars from outside GF</A> - <LI><A HREF="#toc14">GF scripts</A> - <LI><A HREF="#toc15">What else can be done with the grammar</A> - <LI><A HREF="#toc16">Embedded grammar applications</A> - </UL> - <LI><A HREF="#toc17">Lesson 2: Designing a grammar for complex phrases</A> - <UL> - <LI><A HREF="#toc18">The abstract syntax Food</A> - <LI><A HREF="#toc19">The concrete syntax FoodEng</A> - <UL> - <LI><A HREF="#toc20">Exercises on the Food grammar</A> - </UL> - <LI><A HREF="#toc21">Commands for testing grammars</A> - <UL> - <LI><A HREF="#toc22">Generating trees and strings</A> - <LI><A HREF="#toc23">Exercises on generation</A> - <LI><A HREF="#toc24">More on pipes: tracing</A> - <LI><A HREF="#toc25">Writing and reading files</A> - <LI><A HREF="#toc26">Visualizing trees</A> - <LI><A HREF="#toc27">System commands</A> - </UL> - <LI><A HREF="#toc28">An Italian concrete syntax</A> - <UL> - <LI><A HREF="#toc29">Exercises on multilinguality</A> - </UL> - <LI><A HREF="#toc30">Free variation</A> - <LI><A HREF="#toc31">More application of multilingual grammars</A> - <UL> - <LI><A HREF="#toc32">Multilingual treebanks</A> - <LI><A HREF="#toc33">Translation quiz</A> - </UL> - <LI><A HREF="#toc34">Context-free grammars and GF</A> - <UL> - <LI><A HREF="#toc35">The "cf" grammar format</A> - <LI><A HREF="#toc36">Restrictions of context-free grammars</A> - </UL> - <LI><A HREF="#toc37">Modules and files</A> - <LI><A HREF="#toc38">Using operations and resource modules</A> - <UL> - <LI><A HREF="#toc39">Operation definitions</A> - <LI><A HREF="#toc40">The ``resource`` module type</A> - <LI><A HREF="#toc41">Opening a resource</A> - <LI><A HREF="#toc42">Partial application</A> - <LI><A HREF="#toc43">Testing resource modules</A> - </UL> - <LI><A HREF="#toc44">Grammar architecture</A> - <UL> - <LI><A HREF="#toc45">Extending a grammar</A> - <LI><A HREF="#toc46">Multiple inheritance</A> - </UL> - </UL> - <LI><A HREF="#toc47">Lesson 3: Grammars with parameters</A> - <UL> - <LI><A HREF="#toc48">The problem: words have to be inflected</A> - <LI><A HREF="#toc49">Parameters and tables</A> - <LI><A HREF="#toc50">Inflection tables and paradigms</A> - <UL> - <LI><A HREF="#toc51">Exercises on morphology</A> - </UL> - <LI><A HREF="#toc52">Using parameters in concrete syntax</A> - <UL> - <LI><A HREF="#toc53">Agreement</A> - <LI><A HREF="#toc54">Determiners</A> - <LI><A HREF="#toc55">Parametric vs. inherent features</A> - </UL> - <LI><A HREF="#toc56">An English concrete syntax for Foods with parameters</A> - <LI><A HREF="#toc57">More on inflection paradigms</A> - <UL> - <LI><A HREF="#toc58">Worst-case functions</A> - <LI><A HREF="#toc59">Smart paradigms</A> - <LI><A HREF="#toc60">Exercises on regular patterns</A> - <LI><A HREF="#toc61">Function types with variables</A> - <LI><A HREF="#toc62">Separating operation types and definitions</A> - <LI><A HREF="#toc63">Overloading of operations</A> - <LI><A HREF="#toc64">Morphological analysis and morphology quiz</A> - </UL> - <LI><A HREF="#toc65">The Italian Foods grammar</A> - <UL> - <LI><A HREF="#toc66">Exercises on using parameters</A> - </UL> - <LI><A HREF="#toc67">Discontinuous constituents</A> - <LI><A HREF="#toc68">Strings at compile time vs. run time</A> - <UL> - <LI><A HREF="#toc69">Supplementary constructs for concrete syntax</A> - </UL> - </UL> - <LI><A HREF="#toc70">Lesson 4: Using the resource grammar library</A> - <UL> - <LI><A HREF="#toc71">The coverage of the library</A> - <LI><A HREF="#toc72">The structure of the library</A> - <UL> - <LI><A HREF="#toc73">Lexical vs. phrasal rules</A> - <LI><A HREF="#toc74">Lexical categories</A> - <LI><A HREF="#toc75">Lexical rules</A> - <LI><A HREF="#toc76">Resource lexicon</A> - <LI><A HREF="#toc77">Phrasal categories</A> - <LI><A HREF="#toc78">Syntactic combinations</A> - <LI><A HREF="#toc79">Example syntactic combination</A> - </UL> - <LI><A HREF="#toc80">The resource API</A> - <UL> - <LI><A HREF="#toc81">A miniature resource API: categories</A> - <LI><A HREF="#toc82">A miniature resource API: rules</A> - <LI><A HREF="#toc83">A miniature resource API: structural words</A> - <LI><A HREF="#toc84">A miniature resource API: paradigms</A> - <LI><A HREF="#toc85">A miniature resource API: more paradigms</A> - <LI><A HREF="#toc86">Exercises</A> - </UL> - <LI><A HREF="#toc87">Example: English</A> - <UL> - <LI><A HREF="#toc88">English example: linearization types and combination rules</A> - <LI><A HREF="#toc89">English example: lexical rules</A> - <LI><A HREF="#toc90">English example: exercises</A> - </UL> - <LI><A HREF="#toc91">Functor implementation of multilingual grammars</A> - <UL> - <LI><A HREF="#toc92">New language by copy and paste</A> - <LI><A HREF="#toc93">Functors: functions on the module level</A> - <LI><A HREF="#toc94">Code for the Foods functor</A> - <LI><A HREF="#toc95">Code for the LexFoods interface</A> - <LI><A HREF="#toc96">Code for a German instance of the lexicon</A> - <LI><A HREF="#toc97">Code for a German functor instantiation</A> - <LI><A HREF="#toc98">Adding languages to a functor implementation</A> - <LI><A HREF="#toc99">Example: adding Finnish</A> - <LI><A HREF="#toc100">A design pattern</A> - <LI><A HREF="#toc101">Functors: exercises</A> - </UL> - <LI><A HREF="#toc102">Restricted inheritance</A> - <UL> - <LI><A HREF="#toc103">A problem with functors</A> - <LI><A HREF="#toc104">Restricted inheritance: include or exclude</A> - <LI><A HREF="#toc105">The functor problem solved</A> - </UL> - <LI><A HREF="#toc106">Grammar reuse</A> - <UL> - <LI><A HREF="#toc107">Library exercises</A> - </UL> - <LI><A HREF="#toc108">Tenses</A> - </UL> - <LI><A HREF="#toc109">Lesson 5: Refining semantics in abstract syntax</A> - <UL> - <LI><A HREF="#toc110">Dependent types</A> - <UL> - <LI><A HREF="#toc111">A dependent type system</A> - <LI><A HREF="#toc112">Examples of devices and actions</A> - <LI><A HREF="#toc113">Linearization and parsing with dependent types</A> - <LI><A HREF="#toc114">Solving metavariables</A> - </UL> - <LI><A HREF="#toc115">Polymorphism</A> - <UL> - <LI><A HREF="#toc116">Dependent types: exercises</A> - </UL> - <LI><A HREF="#toc117">Proof objects</A> - <UL> - <LI><A HREF="#toc118">Proof-carrying documents</A> - </UL> - <LI><A HREF="#toc119">Restricted polymorphism</A> - <UL> - <LI><A HREF="#toc120">Example: classes for switching and dimming</A> - </UL> - <LI><A HREF="#toc121">Variable bindings</A> - <UL> - <LI><A HREF="#toc122">Higher-order abstract syntax</A> - <LI><A HREF="#toc123">Higher-order abstract syntax: linearization</A> - <LI><A HREF="#toc124">Eta expansion</A> - <LI><A HREF="#toc125">Parsing variable bindings</A> - <LI><A HREF="#toc126">Exercises on variable bindings</A> - </UL> - <LI><A HREF="#toc127">Semantic definitions</A> - <UL> - <LI><A HREF="#toc128">Computing a tree</A> - <LI><A HREF="#toc129">Definitional equality</A> - <LI><A HREF="#toc130">Judgement forms for constructors</A> - <LI><A HREF="#toc131">Exercises on semantic definitions</A> - </UL> - <LI><A HREF="#toc132">Lesson 6: Grammars of formal languages</A> - <UL> - <LI><A HREF="#toc133">Arithmetic expressions</A> - <LI><A HREF="#toc134">Concrete syntax: a simple approach</A> - </UL> - <LI><A HREF="#toc135">Lexing and unlexing</A> - <UL> - <LI><A HREF="#toc136">Most common lexers and unlexers</A> - </UL> - <LI><A HREF="#toc137">Precedence and fixity</A> - <UL> - <LI><A HREF="#toc138">Precedence as a parameter</A> - <LI><A HREF="#toc139">Fixities</A> - <LI><A HREF="#toc140">Exercises on precedence</A> - </UL> - <LI><A HREF="#toc141">Code generation as linearization</A> - <UL> - <LI><A HREF="#toc142">Programs with variables</A> - <LI><A HREF="#toc143">Exercises on code generation</A> - </UL> - </UL> - <LI><A HREF="#toc144">Lesson 7: Embedded grammars</A> - <UL> - <LI><A HREF="#toc145">Functionalities of an embedded grammar format</A> - <LI><A HREF="#toc146">The portable grammar format</A> - <UL> - <LI><A HREF="#toc147">Haskell: the EmbedAPI module</A> - <LI><A HREF="#toc148">First application: a translator</A> - <LI><A HREF="#toc149">Producing GFCC for the translator</A> - <LI><A HREF="#toc150">A translator loop</A> - <LI><A HREF="#toc151">A question-answer system</A> - <LI><A HREF="#toc152">Abstract syntax of the query system</A> - <LI><A HREF="#toc153">Exporting GF datatypes to Haskell</A> - <LI><A HREF="#toc154">The question-answer function</A> - <LI><A HREF="#toc155">Converting between Haskell and GF trees</A> - <LI><A HREF="#toc156">Putting it all together: the transfer definition</A> - <LI><A HREF="#toc157">Putting it all together: the Main module</A> - <LI><A HREF="#toc158">Putting it all together: the Makefile</A> - </UL> - <LI><A HREF="#toc159">Web server applications</A> - <LI><A HREF="#toc160">JavaScript applications</A> - <UL> - <LI><A HREF="#toc161">Compiling to JavaScript</A> - <LI><A HREF="#toc162">Using the JavaScript grammar</A> - </UL> - <LI><A HREF="#toc163">Language models for speech recognition</A> - <UL> - <LI><A HREF="#toc164">More speech recognition grammar formats</A> - </UL> - </UL> - </UL> - -<P></P> -<HR NOSHADE SIZE=1> -<P></P> <P> <!-- NEW --> </P> -<A NAME="toc1"></A> <H1>Overview</H1> <P> This is a hands-on introduction to grammar writing in GF. @@ -292,7 +40,6 @@ Prerequisites: <P> <!-- NEW --> </P> -<A NAME="toc2"></A> <H2>Outline</H2> <P> <a href="#chaptwo">Lesson 1</a>: a multilingual "Hello World" grammar. English, Finnish, Italian. @@ -319,7 +66,6 @@ and <B>semantic definitions</B>. <P> <!-- NEW --> </P> -<A NAME="toc3"></A> <H2>Slides</H2> <P> You can chop this tutorial into a set of slides by the command @@ -331,7 +77,7 @@ You can chop this tutorial into a set of slides by the command where the program <CODE>htmls</CODE> is distributed with GF (see below), in </P> <P> - <A HREF="http://digitalgrammars.com/gf/src/tools/Htmls.hs"><CODE>GF/src/tools/Htmls.hs</CODE></A> + <A HREF="http://grammaticalframework.org/src/tools/Htmls.hs"><CODE>GF/src/tools/Htmls.hs</CODE></A> </P> <P> The slides will appear as a set of files beginning with <CODE>01-gf-tutorial.htmls</CODE>. @@ -343,7 +89,6 @@ upper left corner of each slide, and the links behind the "Contents" link. <P> <!-- NEW --> </P> -<A NAME="toc4"></A> <H1>Lesson 1: Getting Started with GF</H1> <P> <a name="chaptwo"></a> @@ -360,7 +105,6 @@ Goals: <P> <!-- NEW --> </P> -<A NAME="toc5"></A> <H2>What GF is</H2> <P> We use the term GF for three different things: @@ -389,7 +133,6 @@ using the GF system. <P> <!-- NEW --> </P> -<A NAME="toc6"></A> <H2>GF grammars and language processing tasks</H2> <P> A GF program is called a <B>grammar</B>. @@ -417,13 +160,12 @@ In general, a GF grammar is <B>multilingual</B>: <P> <!-- NEW --> </P> -<A NAME="toc7"></A> <H2>Getting the GF system</H2> <P> Open-source free software, downloaded via the GF Homepage: </P> <P> -<A HREF="http://digitalgrammars.com/gf/"><CODE>digitalgrammars.com/gf</CODE></A> +<A HREF="http://grammaticalframework.org/"><CODE>grammaticalframework.org</CODE></A> </P> <P> There you find @@ -436,17 +178,16 @@ There you find <P> Many examples in this tutorial are -<A HREF="http://digitalgrammars.com/gf/examples/tutorial">online</A>. +<A HREF="http://grammaticalframework.org/examples/tutorial">online</A>. </P> <P> Normally you don't have to compile GF yourself. But, if you do want to compile GF from source follow the -instructions in the <A HREF="gf-developers.html">Developers Guide</A>. +instructions in the <A HREF="../gf-developers.html">Developers Guide</A>. </P> <P> <!-- NEW --> </P> -<A NAME="toc8"></A> <H2>Running the GF system</H2> <P> Type <CODE>gf</CODE> in the Unix (or Cygwin) shell: @@ -479,7 +220,6 @@ follow them. <P> <!-- NEW --> </P> -<A NAME="toc9"></A> <H2>A "Hello World" grammar</H2> <P> Like most programming language tutorials, we start with a @@ -497,7 +237,6 @@ Extra features: <P> <!-- NEW --> </P> -<A NAME="toc10"></A> <H3>The program: abstract syntax and concrete syntaxes</H3> <P> A GF program, in general, is a <B>multilingual grammar</B>. Its main parts @@ -617,7 +356,6 @@ Finnish and an Italian concrete syntaxes: <P> <!-- NEW --> </P> -<A NAME="toc11"></A> <H3>Using grammars in the GF system</H3> <P> In order to compile the grammar in GF, @@ -724,7 +462,6 @@ Linearization is by default to all available languages. <P> <!-- NEW --> </P> -<A NAME="toc12"></A> <H3>Exercises on the Hello World grammar</H3> <OL> <LI>Test the parsing and translation examples shown above, as well as @@ -754,7 +491,6 @@ of a variable. Inspect the error messages generated by GF. <P> <!-- NEW --> </P> -<A NAME="toc13"></A> <H2>Using grammars from outside GF</H2> <P> You can use the <CODE>gf</CODE> program in a Unix pipe. @@ -780,7 +516,6 @@ You can also write a <B>script</B>, a file containing the lines <P> <!-- NEW --> </P> -<A NAME="toc14"></A> <H2>GF scripts</H2> <P> If we name this script <CODE>hello.gfs</CODE>, we can do @@ -806,7 +541,6 @@ translation to the output. <P> <!-- NEW --> </P> -<A NAME="toc15"></A> <H2>What else can be done with the grammar</H2> <P> Some more functions that will be covered: @@ -825,7 +559,6 @@ Some more functions that will be covered: <P> <!-- NEW --> </P> -<A NAME="toc16"></A> <H2>Embedded grammar applications</H2> <P> Application programs, using techniques from <a href="#chapeight">Lesson 7</a>: @@ -847,7 +580,6 @@ Application programs, using techniques from <a href="#chapeight">Lesson 7</a>: <P> <!-- NEW --> </P> -<A NAME="toc17"></A> <H1>Lesson 2: Designing a grammar for complex phrases</H1> <P> <a name="chapthree"></a> @@ -864,7 +596,6 @@ Goals: <P> <!-- NEW --> </P> -<A NAME="toc18"></A> <H2>The abstract syntax Food</H2> <P> Phrases usable for speaking about food: @@ -912,7 +643,6 @@ Example <CODE>Phrase</CODE> <P> <!-- NEW --> </P> -<A NAME="toc19"></A> <H2>The concrete syntax FoodEng</H2> <PRE> concrete FoodEng of Food = { @@ -960,7 +690,6 @@ Parse in other categories setting the <CODE>cat</CODE> flag: <P> <!-- NEW --> </P> -<A NAME="toc20"></A> <H3>Exercises on the Food grammar</H3> <OL> <LI>Extend the <CODE>Food</CODE> grammar by ten new food kinds and @@ -977,9 +706,7 @@ the prefix can occur at most once. <P> <!-- NEW --> </P> -<A NAME="toc21"></A> <H2>Commands for testing grammars</H2> -<A NAME="toc22"></A> <H3>Generating trees and strings</H3> <P> Random generation (<CODE>generate_random = gr</CODE>): build @@ -1041,7 +768,6 @@ What options a command has can be seen by the <CODE>help = h</CODE> command: <P> <!-- NEW --> </P> -<A NAME="toc23"></A> <H3>Exercises on generation</H3> <OL> <LI>If the command <CODE>gt</CODE> generated all @@ -1055,7 +781,6 @@ use the Unix <B>word count</B> command <CODE>wc</CODE> to count lines. <P> <!-- NEW --> </P> -<A NAME="toc24"></A> <H3>More on pipes: tracing</H3> <P> Put the <B>tracing</B> option <CODE>-tr</CODE> to each command whose output you @@ -1080,7 +805,6 @@ strings, and try out the ambiguity test. <P> <!-- NEW --> </P> -<A NAME="toc25"></A> <H3>Writing and reading files</H3> <P> To save the outputs into a file, pipe it to the <CODE>write_file = wf</CODE> command, @@ -1105,7 +829,6 @@ of grammars - the most systematic way to do this is by <P> <!-- NEW --> </P> -<A NAME="toc26"></A> <H3>Visualizing trees</H3> <P> Parentheses give a linear representation of trees, @@ -1148,7 +871,6 @@ program (from the Graphviz package). <P> <!-- NEW --> </P> -<A NAME="toc27"></A> <H3>System commands</H3> <P> You can give a <B>system command</B> without leaving GF: @@ -1177,7 +899,6 @@ a system pipe from a GF command into a Unix command. <P> <!-- NEW --> </P> -<A NAME="toc28"></A> <H2>An Italian concrete syntax</H2> <P> <a name="secanitalian"></a> @@ -1232,7 +953,6 @@ which are introduced in <a href="#chaptwo">Lesson 3</a>.) <P> <!-- NEW --> </P> -<A NAME="toc29"></A> <H3>Exercises on multilinguality</H3> <OL> <LI>Write a concrete syntax of <CODE>Food</CODE> for some other language. @@ -1250,7 +970,6 @@ after having worked out <a href="#chaptwo">Lesson 3</a>. <P> <!-- NEW --> </P> -<A NAME="toc30"></A> <H2>Free variation</H2> <P> Semantically indistinguishable ways of expressing a thing. @@ -1298,9 +1017,7 @@ a variant list must be of the same type. <P> <!-- NEW --> </P> -<A NAME="toc31"></A> <H2>More application of multilingual grammars</H2> -<A NAME="toc32"></A> <H3>Multilingual treebanks</H3> <P> <a name="sectreebank"></a> @@ -1324,7 +1041,6 @@ linearizations in different languages: <P> <!-- NEW --> </P> -<A NAME="toc33"></A> <H3>Translation quiz</H3> <P> <CODE>translation_quiz = tq</CODE>: @@ -1356,9 +1072,7 @@ answer given in another language. <P> <!-- NEW --> </P> -<A NAME="toc34"></A> <H2>Context-free grammars and GF</H2> -<A NAME="toc35"></A> <H3>The "cf" grammar format</H3> <P> The grammar <CODE>FoodEng</CODE> can be written in a BNF format as follows: @@ -1392,7 +1106,6 @@ The compiler creates separate abstract and concrete modules internally. <P> <!-- NEW --> </P> -<A NAME="toc36"></A> <H3>Restrictions of context-free grammars</H3> <P> Separating concrete and abstract syntax allows @@ -1411,7 +1124,6 @@ copy language <CODE>{x x | x <- (a|b)*}</CODE> in GF. <P> <!-- NEW --> </P> -<A NAME="toc37"></A> <H2>Modules and files</H2> <P> GF uses suffixes to recognize different file formats: @@ -1457,9 +1169,7 @@ a second time? Try this in different situations: <P> <!-- NEW --> </P> -<A NAME="toc38"></A> <H2>Using operations and resource modules</H2> -<A NAME="toc39"></A> <H3>Operation definitions</H3> <P> The golden rule of functional programmin: @@ -1521,7 +1231,6 @@ sugar for abstraction: <P> <!-- NEW --> </P> -<A NAME="toc40"></A> <H3>The ``resource`` module type</H3> <P> The <CODE>resource</CODE> module type is used to package @@ -1540,7 +1249,6 @@ The <CODE>resource</CODE> module type is used to package <P> <!-- NEW --> </P> -<A NAME="toc41"></A> <H3>Opening a resource</H3> <P> Any number of <CODE>resource</CODE> modules can be @@ -1573,7 +1281,6 @@ Any number of <CODE>resource</CODE> modules can be <P> <!-- NEW --> </P> -<A NAME="toc42"></A> <H3>Partial application</H3> <P> <a name="secpartapp"></a> @@ -1611,7 +1318,6 @@ such that it allows you to write <P> <!-- NEW --> </P> -<A NAME="toc43"></A> <H3>Testing resource modules</H3> <P> Import with the flag <CODE>-retain</CODE>, @@ -1630,12 +1336,10 @@ Compute the value with <CODE>compute_concrete = cc</CODE>, <P> <!-- NEW --> </P> -<A NAME="toc44"></A> <H2>Grammar architecture</H2> <P> <a name="secarchitecture"></a> </P> -<A NAME="toc45"></A> <H3>Extending a grammar</H3> <P> A new module can <B>extend</B> an old one: @@ -1691,7 +1395,6 @@ possible to build resource hierarchies. <P> <!-- NEW --> </P> -<A NAME="toc46"></A> <H3>Multiple inheritance</H3> <P> Extend several grammars at the same time: @@ -1725,7 +1428,6 @@ where <P> <!-- NEW --> </P> -<A NAME="toc47"></A> <H1>Lesson 3: Grammars with parameters</H1> <P> <a name="chapfour"></a> @@ -1754,7 +1456,6 @@ could be left to library implementors. <P> <!-- NEW --> </P> -<A NAME="toc48"></A> <H2>The problem: words have to be inflected</H2> <P> Plural forms are needed in things like @@ -1787,7 +1488,6 @@ adjectives, and verbs can have in some languages that you know. <P> <!-- NEW --> </P> -<A NAME="toc49"></A> <H2>Parameters and tables</H2> <P> We define the <B>parameter type</B> of number in English by @@ -1898,7 +1598,6 @@ module, which you can test by using the command <CODE>compute_concrete</CODE>. <P> <!-- NEW --> </P> -<A NAME="toc50"></A> <H2>Inflection tables and paradigms</H2> <P> A morphological <B>paradigm</B> is a formula telling how a class of @@ -1950,7 +1649,6 @@ uses a <B>wild card</B> pattern <CODE>_</CODE>. <P> <!-- NEW --> </P> -<A NAME="toc51"></A> <H3>Exercises on morphology</H3> <OL> <LI>Identify cases in which the <CODE>regNoun</CODE> paradigm does not @@ -1963,7 +1661,6 @@ considered in earlier exercises. <P> <!-- NEW --> </P> -<A NAME="toc52"></A> <H2>Using parameters in concrete syntax</H2> <P> Purpose: a more radical @@ -1988,7 +1685,6 @@ This will force us to deal with gender- <P> <!-- NEW --> </P> -<A NAME="toc53"></A> <H3>Agreement</H3> <P> In English, the phrase-forming rule @@ -2030,7 +1726,6 @@ Now we can write <P> <!-- NEW --> </P> -<A NAME="toc54"></A> <H3>Determiners</H3> <P> How does an <CODE>Item</CODE> subject receive its number? The rules @@ -2100,7 +1795,6 @@ In a more <B>lexicalized</B> grammar, determiners would be a category: <P> <!-- NEW --> </P> -<A NAME="toc55"></A> <H3>Parametric vs. inherent features</H3> <P> <CODE>Kind</CODE>s have number as a <B>parametric feature</B>: both singular and plural @@ -2168,7 +1862,6 @@ Notice <P> <!-- NEW --> </P> -<A NAME="toc56"></A> <H2>An English concrete syntax for Foods with parameters</H2> <P> We use some string operations from the library <CODE>Prelude</CODE> are used. @@ -2233,7 +1926,6 @@ We use some string operations from the library <CODE>Prelude</CODE> are used. <P> <!-- NEW --> </P> -<A NAME="toc57"></A> <H2>More on inflection paradigms</H2> <P> <a name="secinflection"></a> @@ -2247,7 +1939,6 @@ add words to a lexicon. <P> <!-- NEW --> </P> -<A NAME="toc58"></A> <H3>Worst-case functions</H3> <P> We perform <B>data abstraction</B> from the type @@ -2337,7 +2028,6 @@ parameters. <P> <!-- NEW --> </P> -<A NAME="toc59"></A> <H3>Smart paradigms</H3> <P> The regular <I>dog</I>-<I>dogs</I> paradigm has @@ -2404,7 +2094,6 @@ the suffix <CODE>"oo"</CODE> prevents <I>bamboo</I> from matching the suffix <P> <!-- NEW --> </P> -<A NAME="toc60"></A> <H3>Exercises on regular patterns</H3> <OL> <LI>The same rules that form plural nouns in English also @@ -2429,7 +2118,6 @@ operation to see whether it correctly changes <I>Arzt</I> to <I>Ärzt</I>, <P> <!-- NEW --> </P> -<A NAME="toc61"></A> <H3>Function types with variables</H3> <P> In <a href="#chapsix">Lesson 5</a>, <B>dependent function types</B> need a notation @@ -2485,7 +2173,6 @@ looking like the expected forms: <P> <!-- NEW --> </P> -<A NAME="toc62"></A> <H3>Separating operation types and definitions</H3> <P> In librarues, it is useful to group type signatures separately from @@ -2505,7 +2192,6 @@ With the <CODE>interface</CODE> and <CODE>instance</CODE> module types <P> <!-- NEW --> </P> -<A NAME="toc63"></A> <H3>Overloading of operations</H3> <P> <B>Overloading</B>: different functions can be given the same name, as e.g. in C++. @@ -2547,7 +2233,6 @@ an overload group. <P> <!-- NEW --> </P> -<A NAME="toc64"></A> <H3>Morphological analysis and morphology quiz</H3> <P> The command <CODE>morpho_analyse = ma</CODE> @@ -2561,7 +2246,7 @@ can be used to read a text and return for each word its analyses The command <CODE>morpho_quiz = mq</CODE> generates inflection exercises. </P> <PRE> - % gf -path=alltenses:prelude $GF_LIB_PATH/alltenses/IrregFre.gfc + % gf -path=alltenses:prelude $GF_LIB_PATH/alltenses/IrregFre.gfo > morpho_quiz -cat=V @@ -2584,7 +2269,6 @@ To create a list for later use, use the command <CODE>morpho_list = ml</CODE> <P> <!-- NEW --> </P> -<A NAME="toc65"></A> <H2>The Italian Foods grammar</H2> <P> <a name="secitalian"></a> @@ -2722,7 +2406,6 @@ The complete set of linearization rules: <P> <!-- NEW --> </P> -<A NAME="toc66"></A> <H3>Exercises on using parameters</H3> <OL> <LI>Experiment with multilingual generation and translation in the @@ -2742,7 +2425,6 @@ now aiming for complete grammatical correctness by the use of parameters. <P> <!-- NEW --> </P> -<A NAME="toc67"></A> <H2>Discontinuous constituents</H2> <P> A linearization record may contain more strings than one, and those @@ -2780,7 +2462,6 @@ but can be defined in GF by using discontinuous constituents. <P> <!-- NEW --> </P> -<A NAME="toc68"></A> <H2>Strings at compile time vs. run time</H2> <P> Tokens are created in the following ways: @@ -2839,7 +2520,6 @@ This topic will be covered in <a href="#seclexing">here</a>. <P> <!-- NEW --> </P> -<A NAME="toc69"></A> <H3>Supplementary constructs for concrete syntax</H3> <H4>Record extension and subtyping</H4> <P> @@ -2901,7 +2581,6 @@ Thus <P> <!-- NEW --> </P> -<A NAME="toc70"></A> <H1>Lesson 4: Using the resource grammar library</H1> <P> <a name="chapfive"></a> @@ -2918,7 +2597,6 @@ Goals: <P> <!-- NEW --> </P> -<A NAME="toc71"></A> <H2>The coverage of the library</H2> <P> The current 12 resource languages are @@ -2945,7 +2623,6 @@ The first three letters (<CODE>Eng</CODE> etc) are used in grammar module names <P> <!-- NEW --> </P> -<A NAME="toc72"></A> <H2>The structure of the library</H2> <P> <a name="seclexical"></a> @@ -2967,7 +2644,6 @@ wider coverage than with semantic grammars. <P> <!-- NEW --> </P> -<A NAME="toc73"></A> <H3>Lexical vs. phrasal rules</H3> <P> A resource grammar has two kinds of categories and two kinds of rules: @@ -2995,7 +2671,6 @@ But it is a good discipline to follow. <P> <!-- NEW --> </P> -<A NAME="toc74"></A> <H3>Lexical categories</H3> <P> Two kinds of lexical categories: @@ -3028,7 +2703,6 @@ Two kinds of lexical categories: <P> <!-- NEW --> </P> -<A NAME="toc75"></A> <H3>Lexical rules</H3> <P> Closed classes: module <CODE>Syntax</CODE>. In the <CODE>Foods</CODE> grammar, we need @@ -3061,7 +2735,6 @@ where we use <CODE>mkN</CODE> from <CODE>ParadigmsEng</CODE>: <P> <!-- NEW --> </P> -<A NAME="toc76"></A> <H3>Resource lexicon</H3> <P> Alternative concrete syntax for @@ -3092,7 +2765,6 @@ Advantages: <P> <!-- NEW --> </P> -<A NAME="toc77"></A> <H3>Phrasal categories</H3> <P> In <CODE>Foods</CODE>, we need just four phrasal categories: @@ -3113,7 +2785,6 @@ Common nouns are made into noun phrases by adding determiners. <P> <!-- NEW --> </P> -<A NAME="toc78"></A> <H3>Syntactic combinations</H3> <P> We need the following combinations: @@ -3142,7 +2813,6 @@ Heavy overloading: the current library <P> <!-- NEW --> </P> -<A NAME="toc79"></A> <H3>Example syntactic combination</H3> <P> The sentence @@ -3168,7 +2838,6 @@ this syntactic tree gives the value of linearizing the semantic tree <P> <!-- NEW --> </P> -<A NAME="toc80"></A> <H2>The resource API</H2> <P> Language-specific and language-independent parts - roughly, @@ -3185,12 +2854,11 @@ Language-specific and language-independent parts - roughly, Full API documentation on-line: the <B>resource synopsis</B>, </P> <P> -<A HREF="http://digitalgrammars.com/gf/lib/resource/doc/synopsis.html"><CODE>digitalgrammars.com/gf/lib/resource/doc/synopsis.html</CODE></A> +<A HREF="http://grammaticalframework.org/lib/doc/synopsis.html"><CODE>grammaticalframework.org/lib/resource/doc/synopsis.html</CODE></A> </P> <P> <!-- NEW --> </P> -<A NAME="toc81"></A> <H3>A miniature resource API: categories</H3> <TABLE CELLPADDING="4" BORDER="1"> <TR> @@ -3248,7 +2916,6 @@ Full API documentation on-line: the <B>resource synopsis</B>, <P> <!-- NEW --> </P> -<A NAME="toc82"></A> <H3>A miniature resource API: rules</H3> <TABLE CELLPADDING="4" BORDER="1"> <TR> @@ -3296,7 +2963,6 @@ Full API documentation on-line: the <B>resource synopsis</B>, <P> <!-- NEW --> </P> -<A NAME="toc83"></A> <H3>A miniature resource API: structural words</H3> <TABLE CELLPADDING="4" BORDER="1"> <TR> @@ -3334,7 +3000,6 @@ Full API documentation on-line: the <B>resource synopsis</B>, <P> <!-- NEW --> </P> -<A NAME="toc84"></A> <H3>A miniature resource API: paradigms</H3> <P> From <CODE>ParadigmsEng</CODE>: @@ -3379,7 +3044,6 @@ From <CODE>ParadigmsIta</CODE>: <P> <!-- NEW --> </P> -<A NAME="toc85"></A> <H3>A miniature resource API: more paradigms</H3> <P> From <CODE>ParadigmsGer</CODE>: @@ -3444,7 +3108,6 @@ From <CODE>ParadigmsFin</CODE>: <P> <!-- NEW --> </P> -<A NAME="toc86"></A> <H3>Exercises</H3> <P> 1. Try out the morphological paradigms in different languages. Do @@ -3459,7 +3122,6 @@ as follows: <P> <!-- NEW --> </P> -<A NAME="toc87"></A> <H2>Example: English</H2> <P> <a name="secenglish"></a> @@ -3493,7 +3155,6 @@ Thus the beginning of the module is <P> <!-- NEW --> </P> -<A NAME="toc88"></A> <H3>English example: linearization types and combination rules</H3> <P> As linearization types, we use clauses for <CODE>Phrase</CODE>, noun phrases @@ -3523,7 +3184,6 @@ Now the combination rules we need almost write themselves automatically: <P> <!-- NEW --> </P> -<A NAME="toc89"></A> <H3>English example: lexical rules</H3> <P> We use resource paradigms and lexical insertion rules. @@ -3549,7 +3209,6 @@ The two-place noun paradigm is needed only once, for <P> <!-- NEW --> </P> -<A NAME="toc90"></A> <H3>English example: exercises</H3> <P> 1. Compile the grammar <CODE>FoodsEng</CODE> and generate @@ -3564,12 +3223,10 @@ grammars presented earlier in this tutorial. <P> <!-- NEW --> </P> -<A NAME="toc91"></A> <H2>Functor implementation of multilingual grammars</H2> <P> <a name="secfunctor"></a> </P> -<A NAME="toc92"></A> <H3>New language by copy and paste</H3> <P> If you write a concrete syntax of <CODE>Foods</CODE> for some other @@ -3600,7 +3257,6 @@ Can we avoid this programming by copy-and-paste? <P> <!-- NEW --> </P> -<A NAME="toc93"></A> <H3>Functors: functions on the module level</H3> <P> <B>Functors</B> familiar from the functional programming languages ML and OCaml, @@ -3645,7 +3301,6 @@ we can write a <B>functor instantiation</B>, <P> <!-- NEW --> </P> -<A NAME="toc94"></A> <H3>Code for the Foods functor</H3> <PRE> --# -path=.:../foods @@ -3681,7 +3336,6 @@ we can write a <B>functor instantiation</B>, <P> <!-- NEW --> </P> -<A NAME="toc95"></A> <H3>Code for the LexFoods interface</H3> <P> <a name="secinterface"></a> @@ -3705,7 +3359,6 @@ we can write a <B>functor instantiation</B>, <P> <!-- NEW --> </P> -<A NAME="toc96"></A> <H3>Code for a German instance of the lexicon</H3> <PRE> instance LexFoodsGer of LexFoods = open SyntaxGer, ParadigmsGer in { @@ -3726,7 +3379,6 @@ we can write a <B>functor instantiation</B>, <P> <!-- NEW --> </P> -<A NAME="toc97"></A> <H3>Code for a German functor instantiation</H3> <PRE> --# -path=.:../foods:present @@ -3739,7 +3391,6 @@ we can write a <B>functor instantiation</B>, <P> <!-- NEW --> </P> -<A NAME="toc98"></A> <H3>Adding languages to a functor implementation</H3> <P> Just two modules are needed: @@ -3765,7 +3416,6 @@ language: <P> <!-- NEW --> </P> -<A NAME="toc99"></A> <H3>Example: adding Finnish</H3> <P> Lexicon instance @@ -3799,7 +3449,6 @@ Functor instantiation <P> <!-- NEW --> </P> -<A NAME="toc100"></A> <H3>A design pattern</H3> <P> This can be seen as a <I>design pattern</I> for multilingual grammars: @@ -3822,7 +3471,6 @@ Of the hand-written modules, only <CODE>LexDomainL</CODE> is language-dependent. <P> <!-- NEW --> </P> -<A NAME="toc101"></A> <H3>Functors: exercises</H3> <P> 1. Compile and test <CODE>FoodsGer</CODE>. @@ -3863,9 +3511,7 @@ The implementation goes in the following phases: <P> <!-- NEW --> </P> -<A NAME="toc102"></A> <H2>Restricted inheritance</H2> -<A NAME="toc103"></A> <H3>A problem with functors</H3> <P> Problem: a functor only works when all languages use the resource <CODE>Syntax</CODE> @@ -3895,7 +3541,6 @@ Problem with this solution: <P> <!-- NEW --> </P> -<A NAME="toc104"></A> <H3>Restricted inheritance: include or exclude</H3> <P> A module may inherit just a selection of names. @@ -3916,7 +3561,6 @@ A concrete syntax of <CODE>Foodmarket</CODE> must make the analogous restriction <P> <!-- NEW --> </P> -<A NAME="toc105"></A> <H3>The functor problem solved</H3> <P> The English instantiation inherits the functor @@ -3938,7 +3582,6 @@ is defined in the body instead: <P> <!-- NEW --> </P> -<A NAME="toc106"></A> <H2>Grammar reuse</H2> <P> Abstract syntax modules can be used as interfaces, @@ -3960,7 +3603,6 @@ The following correspondencies are then applied: <P> <!-- NEW --> </P> -<A NAME="toc107"></A> <H3>Library exercises</H3> <P> 1. Find resource grammar terms for the following @@ -3985,7 +3627,6 @@ Then translate the phrases to other languages. <P> <!-- NEW --> </P> -<A NAME="toc108"></A> <H2>Tenses</H2> <P> <a name="sectense"></a> @@ -4077,7 +3718,6 @@ tenses and moods, e.g. the Romance languages. <P> <!-- NEW --> </P> -<A NAME="toc109"></A> <H1>Lesson 5: Refining semantics in abstract syntax</H1> <P> <a name="chapsix"></a> @@ -4105,7 +3745,6 @@ GF = logical framework + concrete syntax. <P> <!-- NEW --> </P> -<A NAME="toc110"></A> <H2>Dependent types</H2> <P> <a name="secsmarthouse"></a> @@ -4133,7 +3772,6 @@ defines voice commands for household appliances. <P> <!-- NEW --> </P> -<A NAME="toc111"></A> <H3>A dependent type system</H3> <P> Ontology: @@ -4162,7 +3800,6 @@ Abstract syntax formalizing this: <P> <!-- NEW --> </P> -<A NAME="toc112"></A> <H3>Examples of devices and actions</H3> <P> Assume the kinds <CODE>light</CODE> and <CODE>fan</CODE>, @@ -4195,7 +3832,6 @@ but we cannot form the trees <P> <!-- NEW --> </P> -<A NAME="toc113"></A> <H3>Linearization and parsing with dependent types</H3> <P> Concrete syntax does not know if a category is a dependent type. @@ -4238,7 +3874,6 @@ to mark incomplete parts of trees in the syntax editor. <P> <!-- NEW --> </P> -<A NAME="toc114"></A> <H3>Solving metavariables</H3> <P> Use the command <CODE>put_tree = pt</CODE> with the option <CODE>-typecheck</CODE>: @@ -4261,7 +3896,6 @@ is shown and no tree is returned: <P> <!-- NEW --> </P> -<A NAME="toc115"></A> <H2>Polymorphism</H2> <P> <a name="secpolymorphic"></a> @@ -4294,7 +3928,6 @@ to express Haskell-type library functions: <P> <!-- NEW --> </P> -<A NAME="toc116"></A> <H3>Dependent types: exercises</H3> <P> 1. Write an abstract syntax module with above contents @@ -4311,7 +3944,6 @@ and an appropriate English concrete syntax. Try to parse the commands <P> <!-- NEW --> </P> -<A NAME="toc117"></A> <H2>Proof objects</H2> <P> <B>Curry-Howard isomorphism</B> = <B>propositions as types principle</B>: @@ -4356,7 +3988,6 @@ Example: the fact that 2 is less that 4 has the proof object <P> <!-- NEW --> </P> -<A NAME="toc118"></A> <H3>Proof-carrying documents</H3> <P> Idea: to be semantically well-formed, the abstract syntax of a document @@ -4400,7 +4031,6 @@ A legal connection is formed by the function <P> <!-- NEW --> </P> -<A NAME="toc119"></A> <H2>Restricted polymorphism</H2> <P> Above, all Actions were either of @@ -4425,7 +4055,6 @@ The notion of class uses the Curry-Howard isomorphism as follows: <P> <!-- NEW --> </P> -<A NAME="toc120"></A> <H3>Example: classes for switching and dimming</H3> <P> We modify the smart house grammar: @@ -4448,7 +4077,6 @@ Classes for new actions can be added incrementally. <P> <!-- NEW --> </P> -<A NAME="toc121"></A> <H2>Variable bindings</H2> <P> <a name="secbinding"></a> @@ -4482,7 +4110,6 @@ Examples from informal mathematical language: <P> <!-- NEW --> </P> -<A NAME="toc122"></A> <H3>Higher-order abstract syntax</H3> <P> Abstract syntax can use functions as arguments: @@ -4520,7 +4147,6 @@ expressed using higher-order syntactic constructors. <P> <!-- NEW --> </P> -<A NAME="toc123"></A> <H3>Higher-order abstract syntax: linearization</H3> <P> HOAS has proved to be useful in the semantics and computer implementation of @@ -4554,7 +4180,6 @@ If there are more bindings, we add <CODE>$1</CODE>, <CODE>$2</CODE>, etc. <P> <!-- NEW --> </P> -<A NAME="toc124"></A> <H3>Eta expansion</H3> <P> To make sense of linearization, syntax trees must be @@ -4603,7 +4228,6 @@ The linearization of the variable <CODE>x</CODE> is, <P> <!-- NEW --> </P> -<A NAME="toc125"></A> <H3>Parsing variable bindings</H3> <P> GF can treat any one-word string as a variable symbol. @@ -4623,7 +4247,6 @@ Variables must be bound if they are used: <P> <!-- NEW --> </P> -<A NAME="toc126"></A> <H3>Exercises on variable bindings</H3> <P> 1. Write an abstract syntax of the whole @@ -4642,7 +4265,6 @@ guarantee non-ambiguity. <P> <!-- NEW --> </P> -<A NAME="toc127"></A> <H2>Semantic definitions</H2> <P> <a name="secdefdef"></a> @@ -4681,7 +4303,6 @@ The key word is <CODE>def</CODE>: <P> <!-- NEW --> </P> -<A NAME="toc128"></A> <H3>Computing a tree</H3> <P> Computation: follow a chain of definition until no definition @@ -4707,7 +4328,6 @@ Computation in GF is performed with the <CODE>put_term</CODE> command and the <P> <!-- NEW --> </P> -<A NAME="toc129"></A> <H3>Definitional equality</H3> <P> Two trees are definitionally equal if they compute into the same tree. @@ -4735,7 +4355,6 @@ so that an object of one also is an object of the other. <P> <!-- NEW --> </P> -<A NAME="toc130"></A> <H3>Judgement forms for constructors</H3> <P> The judgement form <CODE>data</CODE> tells that a category has @@ -4765,7 +4384,6 @@ marked as <CODE>data</CODE> will be treated as variables. <P> <!-- NEW --> </P> -<A NAME="toc131"></A> <H3>Exercises on semantic definitions</H3> <P> 1. Implement an interpreter of a small functional programming @@ -4781,7 +4399,6 @@ Type checking can be invoked with <CODE>put_term -transform=solve</CODE>. <P> <!-- NEW --> </P> -<A NAME="toc132"></A> <H2>Lesson 6: Grammars of formal languages</H2> <P> <a name="chapseven"></a> @@ -4798,7 +4415,6 @@ Goals: <P> <!-- NEW --> </P> -<A NAME="toc133"></A> <H3>Arithmetic expressions</H3> <P> We construct a calculator with addition, subtraction, multiplication, and @@ -4829,7 +4445,6 @@ grammars are not allowed to declare functions with <CODE>Int</CODE> as value typ <P> <!-- NEW --> </P> -<A NAME="toc134"></A> <H3>Concrete syntax: a simple approach</H3> <P> We begin with a @@ -4871,7 +4486,6 @@ First problems: <P> <!-- NEW --> </P> -<A NAME="toc135"></A> <H2>Lexing and unlexing</H2> <P> <a name="seclexing"></a> @@ -4924,7 +4538,6 @@ In linearization, we use a corresponding <B>unlexer</B>: <P> <!-- NEW --> </P> -<A NAME="toc136"></A> <H3>Most common lexers and unlexers</H3> <TABLE ALIGN="center" CELLPADDING="4" BORDER="1"> <TR> @@ -4962,7 +4575,6 @@ In linearization, we use a corresponding <B>unlexer</B>: <P> <!-- NEW --> </P> -<A NAME="toc137"></A> <H2>Precedence and fixity</H2> <P> Arithmetic expressions should be unambiguous. If we write @@ -5001,7 +4613,6 @@ The usual precedence rules: <P> <!-- NEW --> </P> -<A NAME="toc138"></A> <H3>Precedence as a parameter</H3> <P> Precedence can be made into an inherent feature of expressions: @@ -5046,7 +4657,6 @@ This idea is encoded in the operation <P> <!-- NEW --> </P> -<A NAME="toc139"></A> <H3>Fixities</H3> <P> We can define left-associative infix expressions: @@ -5087,7 +4697,6 @@ Now we can write the whole concrete syntax of <CODE>Calculator</CODE> compactly: <P> <!-- NEW --> </P> -<A NAME="toc140"></A> <H3>Exercises on precedence</H3> <P> 1. Define non-associative and right-associative infix operations @@ -5101,7 +4710,6 @@ Test parsing with and without a pipe to <CODE>pt -transform=compute</CODE>. <P> <!-- NEW --> </P> -<A NAME="toc141"></A> <H2>Code generation as linearization</H2> <P> Translate arithmetic (infix) to JVM (postfix): @@ -5131,7 +4739,6 @@ Just give linearization rules for JVM: <P> <!-- NEW --> </P> -<A NAME="toc142"></A> <H3>Programs with variables</H3> <P> A <B>straight code</B> programming language, with @@ -5180,7 +4787,6 @@ of the extension is <CODE>Prog</CODE>. <P> <!-- NEW --> </P> -<A NAME="toc143"></A> <H3>Exercises on code generation</H3> <P> 1. Define a C-like concrete syntax of the straight-code language. @@ -5221,7 +4827,6 @@ point literals as arguments. <P> <!-- NEW --> </P> -<A NAME="toc144"></A> <H1>Lesson 7: Embedded grammars</H1> <P> <a name="chapeight"></a> @@ -5239,7 +4844,6 @@ Goals: <P> <!-- NEW --> </P> -<A NAME="toc145"></A> <H2>Functionalities of an embedded grammar format</H2> <P> GF grammars can be used as parts of programs written in other programming @@ -5256,17 +4860,16 @@ This facility is based on several components: <P> <!-- NEW --> </P> -<A NAME="toc146"></A> <H2>The portable grammar format</H2> <P> The portable format is called PGF, "Portable Grammar Format". </P> <P> -This format is produced by the GF batch compiler <CODE>gfc</CODE>, +This format is produced by the GF batch compiler <CODE>gf</CODE>, executable from the operative system shell: </P> <PRE> - % gfc --make SOURCE.gf + % gf --make SOURCE.gf </PRE> <P> PGF is the recommended format in @@ -5284,7 +4887,6 @@ general-purpose programming (or bytecode in Java). <P> <!-- NEW --> </P> -<A NAME="toc147"></A> <H3>Haskell: the EmbedAPI module</H3> <P> The Haskell API contains (among other things) the following types and functions: @@ -5313,7 +4915,6 @@ It is available as a part of the GF distribution, in the file <P> <!-- NEW --> </P> -<A NAME="toc148"></A> <H3>First application: a translator</H3> <P> Let us first build a stand-alone translator, which can translate @@ -5348,14 +4949,13 @@ For this, you need the Haskell compiler <A HREF="http://www.haskell.org/ghc">GHC <P> <!-- NEW --> </P> -<A NAME="toc149"></A> -<H3>Producing GFCC for the translator</H3> +<H3>Producing PGF for the translator</H3> <P> -Then produce a GFCC file. For instance, the <CODE>Food</CODE> grammar set can be +Then produce a PGF file. For instance, the <CODE>Food</CODE> grammar set can be compiled as follows: </P> <PRE> - % gfc --make FoodEng.gf FoodIta.gf + % gf --make FoodEng.gf FoodIta.gf </PRE> <P> This produces the file <CODE>Food.pgf</CODE> (its name comes from the abstract syntax). @@ -5376,7 +4976,6 @@ The result is given in all languages except the input language. <P> <!-- NEW --> </P> -<A NAME="toc150"></A> <H3>A translator loop</H3> <P> To avoid starting the translator over and over again: @@ -5398,7 +4997,6 @@ is <CODE>quit</CODE>. <P> <!-- NEW --> </P> -<A NAME="toc151"></A> <H3>A question-answer system</H3> <P> <a name="secmathprogram"></a> @@ -5443,7 +5041,6 @@ To reply in the <I>same</I> language as the question: <P> <!-- NEW --> </P> -<A NAME="toc152"></A> <H3>Abstract syntax of the query system</H3> <P> Input: abstract syntax judgements @@ -5470,20 +5067,19 @@ Input: abstract syntax judgements <P> <!-- NEW --> </P> -<A NAME="toc153"></A> <H3>Exporting GF datatypes to Haskell</H3> <P> To make it easy to define a transfer function, we export the abstract syntax to a system of Haskell datatypes: </P> <PRE> - % gfc --output-format=haskell Query.pgf + % gf --output-format=haskell Query.pgf </PRE> <P> -It is also possible to produce the Haskell file together with GFCC, by +It is also possible to produce the Haskell file together with PGF, by </P> <PRE> - % gfc --make --output-format=haskell QueryEng.gf + % gf --make --output-format=haskell QueryEng.gf </PRE> <P> The result is a file named <CODE>Query.hs</CODE>, containing a @@ -5521,7 +5117,6 @@ The Haskell module name is the same as the abstract syntax name. <P> <!-- NEW --> </P> -<A NAME="toc154"></A> <H3>The question-answer function</H3> <P> Haskell's type checker guarantees that the functions are well-typed also with @@ -5545,7 +5140,6 @@ respect to GF. <P> <!-- NEW --> </P> -<A NAME="toc155"></A> <H3>Converting between Haskell and GF trees</H3> <P> The generated Haskell module also contains @@ -5578,7 +5172,6 @@ For the programmer, it is enougo to know: <P> <!-- NEW --> </P> -<A NAME="toc156"></A> <H3>Putting it all together: the transfer definition</H3> <PRE> module TransferDef where @@ -5612,7 +5205,6 @@ For the programmer, it is enougo to know: <P> <!-- NEW --> </P> -<A NAME="toc157"></A> <H3>Putting it all together: the Main module</H3> <P> Here is the complete code in the Haskell file <CODE>TransferLoop.hs</CODE>. @@ -5644,14 +5236,13 @@ Here is the complete code in the Haskell file <CODE>TransferLoop.hs</CODE>. <P> <!-- NEW --> </P> -<A NAME="toc158"></A> <H3>Putting it all together: the Makefile</H3> <P> To automate the production of the system, we write a <CODE>Makefile</CODE> as follows: </P> <PRE> all: - gfc --make --output-format=haskell QueryEng + gf --make --output-format=haskell QueryEng ghc --make -o ./math TransferLoop.hs strip math </PRE> @@ -5682,7 +5273,6 @@ Just to summarize, the source of the application consists of the following files <P> <!-- NEW --> </P> -<A NAME="toc159"></A> <H2>Web server applications</H2> <P> PGF files can be used in web servers, for which there is a Haskell library included @@ -5701,7 +5291,6 @@ is an example of its application to the <CODE>Foods</CODE> grammars. <P> <!-- NEW --> </P> -<A NAME="toc160"></A> <H2>JavaScript applications</H2> <P> JavaScript is a programming language that has interpreters built in in most @@ -5715,14 +5304,13 @@ program compiled from GF grammars as run on an iPhone. <P> <!-- NEW --> </P> -<A NAME="toc161"></A> <H3>Compiling to JavaScript</H3> <P> JavaScript is one of the output formats of the GF batch compiler. Thus the following command generates a JavaScript file from two <CODE>Food</CODE> grammars. </P> <PRE> - % gfc --make --output-format=js FoodEng.gf FoodIta.gf + % gf --make --output-format=js FoodEng.gf FoodIta.gf </PRE> <P> The name of the generated file is <CODE>Food.js</CODE>, derived from the top-most abstract @@ -5731,7 +5319,6 @@ syntax name. This file contains the multilingual grammar as a JavaScript object. <P> <!-- NEW --> </P> -<A NAME="toc162"></A> <H3>Using the JavaScript grammar</H3> <P> To perform parsing and linearization, the run-time library @@ -5741,7 +5328,7 @@ as templates for building applications. </P> <P> An example of usage is -<A HREF="../lib/javascript/translator.html"><CODE>translator.html</CODE></A>, +<A HREF="http://grammaticalframework.org:41296"><CODE>translator.html</CODE></A>, which is in fact initialized with a pointer to the Food grammar, so that it provides translation between the English and Italian grammars: @@ -5752,12 +5339,11 @@ and Italian grammars: <P> The grammar must have the name <CODE>grammar.js</CODE>. The abstract syntax and start category names in <CODE>translator.html</CODE> must match the ones in the grammar. -With these changes, the translator works for any multilingual GF grammar. +With these changes, the translator works for any multilingual grammar. </P> <P> <!-- NEW --> </P> -<A NAME="toc163"></A> <H2>Language models for speech recognition</H2> <P> The standard way of using GF in speech recognition is by building @@ -5768,14 +5354,14 @@ GF supports several formats, including GSL, the formatused in the <A HREF="http://www.nuance.com">Nuance speech recognizer</A>. </P> <P> -GSL is produced from GF by running <CODE>gfc</CODE> with the flag +GSL is produced from GF by running <CODE>gf</CODE> with the flag <CODE>--output-format=gsl</CODE>. </P> <P> Example: GSL generated from <CODE>FoodsEng.gf</CODE>. </P> <PRE> - % gfc --make --output-format=gsl FoodsEng.gf + % gf --make --output-format=gsl FoodsEng.gf % more FoodsEng.gsl ;GSL2.0 @@ -5804,7 +5390,6 @@ Example: GSL generated from <CODE>FoodsEng.gf</CODE>. <P> <!-- NEW --> </P> -<A NAME="toc164"></A> <H3>More speech recognition grammar formats</H3> <P> Other formats available via the <CODE>--output-format</CODE> flag include: @@ -5849,9 +5434,9 @@ Other formats available via the <CODE>--output-format</CODE> flag include: </TABLE> <P> -All currently available formats can be seen with <CODE>gfc --help</CODE>. +All currently available formats can be seen with <CODE>gf --help</CODE>. </P> <!-- html code generated by txt2tags 2.4 (http://txt2tags.sf.net) --> -<!-- cmdline: txt2tags -\-toc -thtml gf-tutorial.txt --> +<!-- cmdline: txt2tags gf-tutorial.txt --> </BODY></HTML> diff --git a/doc/gf-tutorial.txt b/doc/tutorial/gf-tutorial.txt index 8e8b8172a..8ae053a99 100644 --- a/doc/gf-tutorial.txt +++ b/doc/tutorial/gf-tutorial.txt @@ -1,6 +1,6 @@ Grammatical Framework Tutorial Aarne Ranta -Version 3.1.2, November 2008 +December 2010 (November 2008) % NOTE: this is a txt2tags file. @@ -626,7 +626,7 @@ You can chop this tutorial into a set of slides by the command ``` where the program ``htmls`` is distributed with GF (see below), in - [``GF/src/tools/Htmls.hs`` http://digitalgrammars.com/gf/src/tools/Htmls.hs] + [``GF/src/tools/Htmls.hs`` http://grammaticalframework.org/src/tools/Htmls.hs] The slides will appear as a set of files beginning with ``01-gf-tutorial.htmls``. @@ -700,7 +700,7 @@ In general, a GF grammar is **multilingual**: Open-source free software, downloaded via the GF Homepage: -[``digitalgrammars.com/gf`` http://digitalgrammars.com/gf/] +[``grammaticalframework.org`` http://grammaticalframework.org/] There you find - binaries for Linux, Mac OS X, and Windows @@ -709,11 +709,11 @@ There you find Many examples in this tutorial are -[online http://digitalgrammars.com/gf/examples/tutorial]. +[online http://grammaticalframework.org/examples/tutorial]. Normally you don't have to compile GF yourself. But, if you do want to compile GF from source follow the -instructions in the [Developers Guide gf-developers.html]. +instructions in the [Developers Guide ../gf-developers.html]. #NEW @@ -2453,7 +2453,7 @@ can be used to read a text and return for each word its analyses ``` The command ``morpho_quiz = mq`` generates inflection exercises. ``` - % gf -path=alltenses:prelude $GF_LIB_PATH/alltenses/IrregFre.gfc + % gf -path=alltenses:prelude $GF_LIB_PATH/alltenses/IrregFre.gfo > morpho_quiz -cat=V @@ -2970,7 +2970,7 @@ Language-specific and language-independent parts - roughly, Full API documentation on-line: the **resource synopsis**, -[``digitalgrammars.com/gf/lib/resource/doc/synopsis.html`` http://digitalgrammars.com/gf/lib/resource/doc/synopsis.html] +[``grammaticalframework.org/lib/resource/doc/synopsis.html`` http://grammaticalframework.org/lib/doc/synopsis.html] #NEW @@ -4530,10 +4530,10 @@ This facility is based on several components: The portable format is called PGF, "Portable Grammar Format". -This format is produced by the GF batch compiler ``gfc``, +This format is produced by the GF batch compiler ``gf``, executable from the operative system shell: ``` - % gfc --make SOURCE.gf + % gf --make SOURCE.gf ``` PGF is the recommended format in which final grammar products are distributed, because they @@ -4605,12 +4605,12 @@ For this, you need the Haskell compiler [GHC http://www.haskell.org/ghc]. #NEW -===Producing GFCC for the translator=== +===Producing PGF for the translator=== -Then produce a GFCC file. For instance, the ``Food`` grammar set can be +Then produce a PGF file. For instance, the ``Food`` grammar set can be compiled as follows: ``` - % gfc --make FoodEng.gf FoodIta.gf + % gf --make FoodEng.gf FoodIta.gf ``` This produces the file ``Food.pgf`` (its name comes from the abstract syntax). @@ -4714,11 +4714,11 @@ abstract Query = { To make it easy to define a transfer function, we export the abstract syntax to a system of Haskell datatypes: ``` - % gfc --output-format=haskell Query.pgf + % gf --output-format=haskell Query.pgf ``` -It is also possible to produce the Haskell file together with GFCC, by +It is also possible to produce the Haskell file together with PGF, by ``` - % gfc --make --output-format=haskell QueryEng.gf + % gf --make --output-format=haskell QueryEng.gf ``` The result is a file named ``Query.hs``, containing a module named ``Query``. @@ -4871,7 +4871,7 @@ translate tr gr s = case parseAllLang gr (startCat gr) s of To automate the production of the system, we write a ``Makefile`` as follows: ``` all: - gfc --make --output-format=haskell QueryEng + gf --make --output-format=haskell QueryEng ghc --make -o ./math TransferLoop.hs strip math ``` @@ -4928,7 +4928,7 @@ program compiled from GF grammars as run on an iPhone. JavaScript is one of the output formats of the GF batch compiler. Thus the following command generates a JavaScript file from two ``Food`` grammars. ``` - % gfc --make --output-format=js FoodEng.gf FoodIta.gf + % gf --make --output-format=js FoodEng.gf FoodIta.gf ``` The name of the generated file is ``Food.js``, derived from the top-most abstract syntax name. This file contains the multilingual grammar as a JavaScript object. @@ -4944,7 +4944,7 @@ some other JavaScript and HTML files; these files can be used as templates for building applications. An example of usage is -[``translator.html`` ../lib/javascript/translator.html], +[``translator.html`` http://grammaticalframework.org:41296], which is in fact initialized with a pointer to the Food grammar, so that it provides translation between the English and Italian grammars: @@ -4969,12 +4969,12 @@ The standard way of using GF in speech recognition is by building GF supports several formats, including GSL, the formatused in the [Nuance speech recognizer www.nuance.com]. -GSL is produced from GF by running ``gfc`` with the flag +GSL is produced from GF by running ``gf`` with the flag ``--output-format=gsl``. Example: GSL generated from ``FoodsEng.gf``. ``` - % gfc --make --output-format=gsl FoodsEng.gf + % gf --make --output-format=gsl FoodsEng.gf % more FoodsEng.gsl ;GSL2.0 @@ -5017,6 +5017,6 @@ Other formats available via the ``--output-format`` flag include: | ``slf`` | finite automaton in the HTK SLF format | ``slf_sub`` | finite automaton with sub-automata in HTK SLF -All currently available formats can be seen with ``gfc --help``. +All currently available formats can be seen with ``gf --help``. diff --git a/doc/iphone.jpg b/doc/tutorial/iphone.jpg Binary files differindex d9e138b88..d9e138b88 100644 --- a/doc/iphone.jpg +++ b/doc/tutorial/iphone.jpg diff --git a/doc/mytree.png b/doc/tutorial/mytree.png Binary files differindex fafcc8772..fafcc8772 100644 --- a/doc/mytree.png +++ b/doc/tutorial/mytree.png diff --git a/index.html b/index.html index 3a23a66a9..d88e3b6df 100644 --- a/index.html +++ b/index.html @@ -26,11 +26,13 @@ April 2010 | <A HREF="download/index.html">Download</A> | <A HREF="lib/doc/synopsis.html">Libraries</A> | <A HREF="doc/gf-refman.html">Reference</A> -| <A HREF="doc/gf-tutorial.html">Tutorial</A> +| <A HREF="doc/tutorial/gf-tutorial.html">Tutorial</A> +| <A HREF="doc/gf-quickstart.html">QuickStart</A> +| <A HREF="http://groups.google.com/group/gf-dev">UserGroup</A> ] </font> <P> -[ <A HREF="http://code.google.com/p/grammatical-framework/wiki/SideBar?tm=6">Developers</A> +[ <A HREF="http://code.google.com/p/grammatical-framework/wiki/SideBar?tm=6">ForDevelopers</A> | <A HREF="doc/gf-people.html">People</A> | <A HREF="doc/gf-bibliography.html">Publications</A> | <A HREF="doc/gf-reference.html">QuickRefCard</A> @@ -139,7 +141,7 @@ fifty scientific publications (see <A HREF="doc/gf-bibliography.html">GF publica </P> <H2>Programming in GF</H2> <P> -GF is easy to learn by following the <A HREF="doc/gf-tutorial.html">tutorial</A>. +GF is easy to learn by following the <A HREF="doc/tutorial/gf-tutorial.html">tutorial</A>. You can write your first translator in 15 minutes. </P> <P> |
