# Grammatical Framework

A programming language for multilingual grammar applications

## News

2017-03-13: | GF Summer School in Riga (Latvia), 14-25 August 2017 Summer School web page.
2016-09-07: | Google Tech Talk on GF on Youtube.
2016-07-05: | GitHub mirror temporarily not updated, due to server migration.
2016-06-22: | GF 3.8 released! Release notes.
2015-06-21: | Summer School in Rule-Based Machine Translation in Alacant/Alicante (Spain), 11-21 July 2016 featuring GF, Apertium, Matxin, and TectoMT. Summer School web page.
2016-06-14: | New resource grammar language: Nynorsk.
2015-10-02: | GF 3.7.1 released! Release notes.
2015-06-25: | GF 3.7 released! Release notes.
2015-03-13: | New resource grammar language: Mongolian. See library synopsis.
2015-02-09: | GF Summer School in Gozo (Malta), 13-24 July 2015 Summer School web page.
2014-06-23: | GF 3.6 released! Release notes.
2014-03-11: | A company for commercial applications of GF has been founded: Digital Grammars.
2013-11-25: | The default character encoding in GF grammar files will be changed from Latin-1 to UTF-8. See GF character encoding changes for details.
2013-10-18: | New resource grammar language: Estonian. See library synopsis.
2013-09-18: | New GF contributions repository, hosted on GitHub.
2013-08-06: | GF 3.5 released! Release notes.
2013-07-26: | Started a page with RGL Documentation and Publications.
2013-06-24: | We are now running the IRC channel `#gf` on the Freenode network.
2013-06-19: | New resource grammar language: Maltese. See library synopsis.
2013-04-25: | New resource grammar language: Greek. See library synopsis.
2013-01-31: | GF 3.4 released! Release notes.
2012-12-10: | Resource Grammar Library coverage map, created by Tommi Nieminen.

## What is GF

GF, Grammatical Framework, is a programming language for multilingual grammar applications. It is

- a special-purpose language for grammars, like YACC, Bison, Happy, BNFC, but not restricted to programming languages
- a functional programming language, like Haskell, Lisp, OCaml, SML, Scheme, but specialized to grammar writing
- a development platform for natural language grammars, like LKB, XLE, Regulus, but based on functional programming and type theory
- a categorial grammar formalism, like ACG, CCG, but specialized for multilingual grammars,
- a logical framework, like Agda, Coq, Isabelle, but equipped with concrete syntax in addition to logic
- a platform for machine translation, like Moses, Apertium, but based on deep structural analysis (and usually applied for limited fragments of language).

Don't worry if you don't know most of the references above - but if you do know at least one, it may help you to get a first idea of what GF is.

## Applications

GF can be used for building

- translation systems
- multilingual web gadgets
- natural-language interfaces
- dialogue systems
- natural language resources

## Availability

GF is open-source, licensed under GPL (the program) and LGPL and BSD (the libraries). It is available for

- Linux
- Mac OS X
- Windows
- Android mobile platform (via Java; runtime)
- via compilation to JavaScript, almost any platform that has a web browser (runtime)

## Projects

GF was first created in 1998 at Xerox Research Centre Europe, Grenoble, in the project Multilingual Document Authoring. At Xerox, it was used for prototypes including a restaurant phrase book, a database query system, a formalization of an alarm system instructions with translations to 5 languages, and an authoring system for medical drug descriptions.

Later projects using GF and involving third parties include, in chronological order,

- GF-Alfa: natural language interface to formal proofs
- Efficient: authoring tool for business models.
- GF-KeY: authoring and translation of software specifications
- TALK: multilingual and multimodal spoken dialogue systems
- WebALT: multilingual generation of mathematical exercises (commercial project)
- SALDO: Swedish morphological dictionary based on rules developed for GF and Functional Morphology
- MOLTO: multilingual online translation
- REMU: reliable multilingual digital communication.

Here is a talk about GF at XRCE, 14 years later.

Academically, GF has been used in at least ten PhD theses and resulted in more than a hundred scientific publications (see GF publication list).

## Programming in GF

GF is easy to learn by following the tutorial. You can write your first translator in 15 minutes.

GF has an interactive command interpreter, as well as a batch compiler. Grammars can be compiled to parser and translator code in many different formats. These components can then be embedded in applications written in other programming languages. The formats currently supported are:

- Haskell
- Java, in particular the Android platform
- JavaScript
- Speech recognition: HTK/ATK, Nuance, JSGF

The GF programming language is high-level and advanced, featuring

- static type checking
- higher-order functions
- dependent types
- pattern matching with data constructors and regular expressions
- module system with multiple inheritance and parametrized modules

### Getting help

If you need some help with GF, the first places to start are the Tutorial and Reference pages. The printed book contains all the material in the tutorial and some extra bits, and is the recommended reference for GF.

We run the IRC channel `#gf` on the Freenode network, where you are welcome to look for help with small questions or just start a general discussion. IRC logs (in raw format) are available here. If you have a larger question which the community may benefit from, we recommend you ask it on the mailing list.

## Libraries

Libraries are at the heart of modern software engineering. In natural language applications, libraries are a way to cope with thousands of details involved in syntax, lexicon, and inflection. The GF resource grammar library has support for an increasing number of languages, currently including

1. Afrikaans
2. Amharic (partial)
3. Arabic (partial)
4. Bulgarian
5. Catalan
6. Chinese
7. Danish
8. Dutch
9. English
10. Estonian
11. Finnish
12. French
13. German
14. Greek ancient (partial)
15. Greek modern
16. Hebrew (fragments)
17. Hindi
18. Interlingua
19. Japanese
20. Italian
21. Latin (fragments)
22. Latvian
23. Maltese
24. Mongolian
25. Nepali
26. Norwegian bokmål
27. Norwegian nynorsk
28. Persian
29. Polish
30. Punjabi
31. Romanian
32. Russian
33. Sindhi
34. Slovene (partial)
35. Spanish
36. Swahili (fragments)
37. Swedish
38. Thai
39. Turkish (fragments)
40. Urdu

Adding a language to the resource library takes 3 to 9 months - contributions are welcome! You can start with the resource grammarian's tutorial.