# Grammatical Framework

#### A programming language for multilingual grammar applications

### Get started

- Google Tech Talk
- GF Cloud
- Tutorial / RGL Tutorial
- Video Tutorials

Download GF

### Learn more

- The GF Book
- Reference Manual
- Shell Reference
- Best Practices [PDF]
- Scaling Up (Computational Linguistics 2020)
- GF WordNet
- GF blog

RGL Synopsis

### Develop

- Developers Guide
- PGF library API:
  Haskell / C runtime
- GF compiler API
- Text Editor Support
- RGL source browser

### Contribute

- IRC / Discord
- Stack Overflow
- Mailing List
- Issue Tracker
- Summer School
- Authors

GF on GitHub

## 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 & availability

GF can be used for building translation systems, multilingual web gadgets, natural-language interfaces, dialogue systems, and natural language resources.

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

- Linux
- macOS
- Windows
- Android mobile platform (via Java; runtime)
- iOS mobile platform (iPhone, iPad)
- via compilation to JavaScript, almost any platform that has a web browser (runtime)

## 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 Libera network, where you are welcome to look for help with small questions or just start a general discussion. You can open a web chat or browse the channel logs.

There is also a GF server on Discord.

For bug reports and feature requests, please create an issue in the GF Core or RGL repository. For programming questions, consider asking them on Stack Overflow with the `gf` tag. If you have a more general question to the community, we recommend you ask it on the mailing list.

## News

2021-07-25
  GF 3.11 released. Release notes
2021-05-05
  GF WordNet now supports languages for which there are no other WordNets. New additions: Afrikaans, German, Korean, Maltese, Polish, Somali, Swahili.
2021-03-01
  Seventh GF Summer School, in Singapore and online, 26 July – 6 August 2021.
2020-09-29
  Abstract Syntax as Interlingua: Scaling Up the Grammatical Framework from Controlled Languages to Robust Pipelines. A paper in Computational Linguistics (2020) summarizing much of the development in GF in the past ten years.

## 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

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

## 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 (RGL) has support for an increasing number of languages, currently including Afrikaans, Amharic (partial), Arabic (partial), Basque (partial), Bulgarian, Catalan, Chinese, Czech (partial), Danish, Dutch, English, Estonian, Finnish, French, German, Greek ancient (partial), Greek modern, Hebrew (fragments), Hindi, Hungarian (partial), Interlingua, Italian, Japanese, Korean (partial), Latin (partial), Latvian, Maltese, Mongolian, Nepali, Norwegian bokmål, Norwegian nynorsk, Persian, Polish, Punjabi, Romanian, Russian, Sindhi, Slovak (partial), Slovene (partial), Somali (partial), Spanish, Swahili (fragments), Swedish, Thai, Turkish (fragments), and 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.