Planned: 24 June 2004
Separate compilation to canonical GF.
Improved GUI.
Improved parser generation.
Improved shell (new commands and options, help, error messages).
Accurate language specification (also of GFC).
Extended resource library.
Extended Numerals library.
The updated HelpFile (accessible through h command) marks unsupported features present in GF 1.2 with *. They will be supported again if interested users appear.
GF1 grammars can be automatically translated to GF2 (although the result is not as good as manual, since indentation and comments are destroyed). The results can be saved in GF2 files, but this is not necessary. Some rarely used GF1 features are no longer supported (see next section).
It is also possible to write a GF2 grammar back to GF1, with the command pg -printer=old. Resource libraries and some example grammars and have been converted. Most old example grammars work without any changes. There is a new resource API with many new constructions.
A make facility works, finding out which modules have to be recompiled.
Soundness checking of module depencencies and completeness is not complete. This means that some errors may show up too late.
The environment variable GF_LIB_PATH needs some more work.
Latex and XML printing of grammars do not work yet.
Very old GF grammars (from versions before 0.9), with the completely different notation, do not work. They should be first converted to GF1 by using GF version 1.2. The import command i can be given the option -old. E.g.
i -old tut1.Eng.g2But this is no more necessary: GF2 detects automatically if a grammar is in the GF1 format.
Importing a set of GF2 files generates, internally, three modules:
abstract tut1 = ... resource ResEng = ... concrete Eng of tut1 = open ResEng in ...(The names are different if the file name has fewer parts.)
The option -o causes GF2 to write these modules into files. The flags -abs, -cnc, and -res can be used to give custom names to the modules. In particular, it is good to use the -abs flag to guarantee that the abstract syntax module has the same name for all grammars in a multilingual environmens:
i -old -abs=Numerals hungarian.gf i -old -abs=Numerals tamil.gf i -old -abs=Numerals sanskrit.gf
The same flags as in the import command can be used when invoking GF2 from the system shell. Many grammars can be imported on the same command line, e.g.
% gf2 -old -abs=Tutorial tut1.Eng.gf tut1.Fin.gf tut1.Fra.gf
To write a GF2 grammar back to GF1 (as one big file), use the command
> pg -oldGF2 has more reserved words than GF 1.2. When old files are read, a preprocessor replaces every identifier that has the shape of a new reserved word with a variant where the last letter is replaced by Z, e.g. instance is replaced by instancZ. This method is of course unsafe and should be replaced by something better.
abstract Sums = {
cat
Exp ;
fun
One : Exp ;
plus : Exp -> Exp -> Exp ;
}
concrete EnglishSums of Sums = open ResEng in {
lincat
Exp = {s : Str ; n : Number} ;
lin
One = expSg "one" ;
sum x y = expSg ("the" ++ "sum" ++ "of" ++ x.s ++ "and" ++ y.s) ;
}
resource ResEng = {
param
Number = Sg | Pl ;
oper
expSG : Str -> {s : Str ; n : Number} = \s -> {s = s ; n = Sg} ;
}
abstract Products = Sums ** {
fun times : Exp -> Exp -> Exp ;
}
-- names exported: Exp, plus, times
concrete English of Products = EnglishSums ** open ResEng in {
lin times x y = expSg ("the" ++ "product" ++ "of" ++ x.s ++ "and" ++ y.s) ;
}
Another important difference:
Example of qualified opening:
concrete NumberSystems of Systems = open (Bin = Binary), (Dec = Decimal) in {
lin
BZero = Bin.Zero ;
DZero = Dec.Zero
}
The module header is the beginning of the module code up to the first left bracket ({). The header gives
File name extensions:
Use the command po = print_options to see what modules are in the state.
To force compilation:
-path=.:../resource/russian:../preludeenables files to be found in three different directories. By default, only the current directory is included. If a path flag is given, the current directory . must be explicitly included if it is wanted.
The path flag can be set in any of the following places:
The value of the environment variable GF_LIB_PATH is appended to the user-given path.
Documentation
Packaging