diff --git a/doc/gf-refman.html b/doc/gf-refman.html index 188a063a8..376689a9a 100644 --- a/doc/gf-refman.html +++ b/doc/gf-refman.html @@ -5,7 +5,7 @@

GF Language Reference Manual

-Aarne Ranta
February 2008 +Aarne Ranta, Krasimir Angelov
November 2013

@@ -39,6 +39,7 @@
  • Linearization type definitions, lincat
  • Linearization definitions, lin
  • Linearization default definitions, lindef +
  • Linearization reference definitions, linref
  • Printname definitions, printname cat and printname fun
  • Parameter type definitions, param
  • Parameter values @@ -968,8 +969,15 @@ name to the scope. yes -lindef f = t -f fun, t term +lindef C = t +C cat, t term +concrete* +yes +no + + +linref C = t +C cat, t term concrete* yes no @@ -1355,11 +1363,17 @@ type of C. Linearization defaults are invoked when linearizing variable bindings in higher-order abstract syntax. A variable symbol is then presented as a string, which must be converted to correct type in order for -linearization not to fail with an error. +the linearization not to fail with an error.

    -The defaults can also be used for linearizing metavariables -in an interactive syntax editor. +The other use of the defaults is for linearizing metavariables +and abstract functions without linearization in the concrete syntax. +In the first case the default linearization is applied to +the string "?X" where X is the unique index +of the metavariable, and in the second case the string is +"[f]" where f is the name of the abstract +function with missing linearization. +

    Usually, linearization defaults are generated by using the default @@ -1376,8 +1390,62 @@ definition is by structural recursion on the type:

    The notion of the first value of a parameter type (#1(P)) is defined -here below. +below.

    + +

    Linearization reference definitions, linref

    +

    + +

    +

    +A linearization reference definition, +

    + linref C = t +
    +defines the reference linearization of category C, i.e. the function +applicable to an object of the linearization type of C to make it into a string. +

    +

    +The reference linearization is always applied to the top-level node +of the abstract syntax tree. For example when we linearize the +tree f x1 x2 .. xn, then we first apply f +to its arguments which gives us an object of the linearization type of +its category. After that we apply the reference linearization +for the same category to get a string out of the object. This +is particularly useful when the linearization type of C +contains discontious constituents. In this case usually the reference +linearization glues the constituents together to produce an +intuitive linearization string. +

    +

    +The reference linearization is also used for linearizing metavariables +which stand in function position. For example the tree +f (? x1 x2 .. xn) is linearized as follows. Each +of the arguments x1 x2 .. xn is linearized, and after that +the reference linearization of the its category is applied +to the output of the linearization. The result is a sequence of n +strings which are concatenated into a single string. The final string +is the input to the default linearization of the category +for the argument of f. After applying the default linearization +we get an object that we could safely pass to f. +

    +

    +Usually, linearization references are generated by using the +rule that "picks the first string in the linearization type". The precise +definition is by structural recursion on the type: +

    + +Here each call to reference returns either (Just o) or Nothing. +When we compute the reference for a table or a record then we pick +the reference for the first expression for which the recursive call +gives us Just. If we get Nothing for +all of them then the final result is Nothing too. +

    Printname definitions, printname cat and printname fun

    @@ -2927,7 +2995,7 @@ literals).

    Predefined concrete syntax operations

    The following predefined operations are defined in the resource module -prelude/Predefined.gf. Their implementations are defined as +prelude/Predef.gf. Their implementations are defined as a part of the GF grammar compiler.

    @@ -3031,6 +3099,26 @@ a part of the GF grammar compiler. + + + + + + + + + + + + + + +
    (L : Type) -> L -> Str find the "first" string
    nonExistStrthis is a special token marking
    +non-existing morphological forms
    BINDStrthis is a special token marking
    +that the surrounding tokens should not
    +be separated by space
    SOFT_BINDStrthis is a special token marking
    +that the surrounding tokens may not
    +be separated by space

    @@ -3427,24 +3515,25 @@ The reserved words used in GF are the following: lindef +linref of open oper -param +param pre printname resource -strs +strs table transfer variants -where +where with @@ -3773,6 +3862,11 @@ All other symbols are terminals. | +linref [Def] + + + +| lin [Def]