forked from GitHub/gf-core
128236eab9f24f7085e1378d3f78306d9cad0658
These changes are inspired by the gf -cshell implementation of these commands.
The output of the linearize command has been changed to remove superfluous
blank lines and commas, and deliver the result as a list of strings instead of
a single multi-line string. This makes it possible to use -all and pipe the
results to the parse command. This also means that with -treebank -all,
the language tag will be repeated for each result from the same language.
The parse command, when trying to parse with more than one language, would
"forget" other results after a failed parse, and thus not send all
successful parses through the pipe. For example, if English is not the first
language in the grammar,
p "hello" | l
would output nothing, instead of translations of "hello" to all languages,
forcing the user to write
p -lang=Eng "hello" | l
instead, to get the expected result. The cause of this behaviour was in the
function fromParse, which was rather messy, so I assume it is not intentional,
but the result of a programming mistake at some point.
The fromParse function has now been refactored from a big recursive function
into
fromParse opts = foldr (joinPiped . fromParse1 opts) void
where the helper functions fromParse1 deals with a single parse result and
joinPiped combines multiple parse results.
DESCRIPTION
The Grammatical Framework (=GF) is a grammar formalism based on type theory.
It consists of
* a special-purpose programming language
* a compiler of the language
* a generic grammar processor
The compiler reads GF grammars from user-provided files, and the
generic grammar processor performs various tasks with the grammars:
* generation
* parsing
* translation
* type checking
* computation
* paraphrasing
* random generation
* syntax editing
GF particularly addresses four aspects of grammars:
* multilinguality (parallel grammars for different languages)
* semantics (semantic conditions of well-formedness, semantic
properties of expressions)
* grammar engineering (modularity, abstractions, libraries)
* embeddability in programs written in other languages (C,C++,
Haskell, Java, JavaScript)
COMPILATION and INSTALLATION of source distribution:
See download/index.html for installation instructions.
(More details can be found in doc/gf-developers.html.)
Description
Languages
Haskell
45%
C
32.9%
JavaScript
10.1%
HTML
3.3%
Grammatical Framework
2.8%
Other
5.8%