From a205829623ea7b928c84e56cd6453148f123a3d5 Mon Sep 17 00:00:00 2001 From: aarne Date: Sat, 17 Dec 2005 22:21:23 +0000 Subject: end of tutorial sketched --- doc/tutorial/gf-tutorial2.html | 189 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 171 insertions(+), 18 deletions(-) (limited to 'doc/tutorial/gf-tutorial2.html') diff --git a/doc/tutorial/gf-tutorial2.html b/doc/tutorial/gf-tutorial2.html index 9730526e2..bb6440ff4 100644 --- a/doc/tutorial/gf-tutorial2.html +++ b/doc/tutorial/gf-tutorial2.html @@ -7,7 +7,7 @@

Grammatical Framework Tutorial

Author: Aarne Ranta <aarne (at) cs.chalmers.se>
-Last update: Sat Dec 17 21:42:39 2005 +Last update: Sat Dec 17 23:19:34 2005

@@ -98,17 +98,22 @@ Last update: Sat Dec 17 21:42:39 2005
  • Dependent types
  • Higher-order abstract syntax
  • Semantic definitions -
  • Case study: grammars of formal languages -
  • Transfer modules -
  • Practical issues +
  • Transfer modules +
  • Practical issues +
  • Case studies + @@ -1779,8 +1784,16 @@ they can be used as arguments. For example:

    More features of the module system

    Resource grammars and their reuse

    +

    +See +resource library documentation +

    Interfaces, instances, and functors

    +

    +See an +example built this way +

    Restricted inheritance and qualified opening

    @@ -1792,23 +1805,163 @@ they can be used as arguments. For example:

    Semantic definitions

    -

    Case study: grammars of formal languages

    -

    Transfer modules

    - +

    +Transfer means noncompositional tree-transforming operations. +The command apply_transfer = at is typically used in a pipe: +

    +
    +    > p "John walks and John runs" | apply_transfer aggregate | l
    +    John walks and runs
    +
    +

    +See the +sources of this example. +

    +

    +See the +transfer language documentation +for more information. +

    +

    Practical issues

    - +

    Lexers and unlexers

    - +

    +Lexers and unlexers can be chosen from +a list of predefined ones, using the flags-lexer and `` -unlexer`` either +in the grammar file or on the GF command line. +

    +

    +Given by help -lexer, help -unlexer: +

    +
    +      The default is words.
    +      -lexer=words         tokens are separated by spaces or newlines
    +      -lexer=literals      like words, but GF integer and string literals recognized
    +      -lexer=vars          like words, but "x","x_...","$...$" as vars, "?..." as meta
    +      -lexer=chars         each character is a token
    +      -lexer=code          use Haskell's lex
    +      -lexer=codevars      like code, but treat unknown words as variables, ?? as meta
    +      -lexer=text          with conventions on punctuation and capital letters
    +      -lexer=codelit       like code, but treat unknown words as string literals
    +      -lexer=textlit       like text, but treat unknown words as string literals
    +      -lexer=codeC         use a C-like lexer
    +      -lexer=ignore        like literals, but ignore unknown words
    +      -lexer=subseqs       like ignore, but then try all subsequences from longest
    +  
    +      The default is unwords.
    +      -unlexer=unwords     space-separated token list (like unwords)
    +      -unlexer=text        format as text: punctuation, capitals, paragraph <p>
    +      -unlexer=code        format as code (spacing, indentation)
    +      -unlexer=textlit     like text, but remove string literal quotes
    +      -unlexer=codelit     like code, but remove string literal quotes
    +      -unlexer=concat      remove all spaces
    +      -unlexer=bind        like identity, but bind at "&+"
    +  
    +
    +

    +

    Efficiency of grammars

    - +

    +Issues: +

    + + +

    Speech input and output

    +

    +Thespeak_aloud = sa command sends a string to the speech +synthesizer +Flite. +It is typically used via a pipe: +

    +
    +   generate_random | linearize | speak_aloud
    +
    +

    +The result is only satisfactory for English. +

    +

    +The speech_input = si command receives a string from a +speech recognizer that requires the installation of +ATK. +It is typically used to pipe input to a parser: +

    +
    +   speech_input -tr | parse
    +
    +

    +The method words only for grammars of English. +

    +

    +Both Flite and ATK are freely available through the links +above, but they are not distributed together with GF. +

    + +

    Multilingual syntax editor

    +

    +The +Editor User Manual +describes the use of the editor, which works for any multilingual GF grammar. +

    +

    +Here is a snapshot of the editor: +

    +

    + +

    +

    +The grammars of the snapshot are from the +Letter grammar package. +

    -

    Communicating with GF

    +

    Interactive Development Environment (IDE)

    +

    +Forthcoming. +

    -

    Embedded grammars in Haskell, Java, and Prolog

    +

    Communicating with GF

    +

    +Other processes can communicate with the GF command interpreter, +and also with the GF syntax editor. +

    +

    Embedded grammars in Haskell, Java, and Prolog

    +

    +GF grammars can be used as parts of programs written in the +following languages. The links give more documentation. +

    + + +

    Alternative input and output grammar formats

    +

    +A summary is given in the following chart of GF grammar compiler phases: + +

    + +

    Case studies

    + +

    Interfacing formal and natural languages

    +

    +Formal and Informal Software Specifications, +PhD Thesis by +Kristofer Johannisson, is an extensive example of this. +The system is based on a multilingual grammar relating the formal language OCL with +English and German. +

    +

    +A simpler example will be explained here. +

    -- cgit v1.2.3