diff options
| author | Arianna Masciolini <uzkamascio@gmail.com> | 2025-08-02 23:01:53 +0200 |
|---|---|---|
| committer | Arianna Masciolini <uzkamascio@gmail.com> | 2025-08-02 23:01:53 +0200 |
| commit | 8f4e8c73d2d17ad49a6b72a93090a7a39e5d84f0 (patch) | |
| tree | 478b68d1e493349f9e74b5c61862830012f2f2f3 /doc | |
| parent | c2431e06b2fcd53e71f06d54b1b74b102aed7590 (diff) | |
| parent | d983255326d232a9d0e1541e5b48743e6ce35e59 (diff) | |
Merge branch 'master' of https://github.com/GrammaticalFramework/gf-core into release-3.12
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/gf-editor-modes.md | 75 | ||||
| -rw-r--r-- | doc/gf-editor-modes.t2t | 81 | ||||
| -rw-r--r-- | doc/gf-help-full.txt | 17 | ||||
| -rw-r--r-- | doc/tutorial/gf-tutorial.t2t | 12 |
4 files changed, 90 insertions, 95 deletions
diff --git a/doc/gf-editor-modes.md b/doc/gf-editor-modes.md new file mode 100644 index 000000000..5351895e0 --- /dev/null +++ b/doc/gf-editor-modes.md @@ -0,0 +1,75 @@ +# Editor modes & IDE integration for GF + +We collect GF modes for various editors on this page. Contributions are welcome! + +## Emacs + +[gf.el](https://github.com/GrammaticalFramework/gf-emacs-mode) by Johan +Bockgård provides syntax highlighting and automatic indentation and +lets you run the GF Shell in an emacs buffer. See installation +instructions inside. + +## Atom + +[language-gf](https://atom.io/packages/language-gf), by John J. Camilleri + +## Visual Studio Code + +* [Grammatical Framework Language Server](https://marketplace.visualstudio.com/items?itemName=anka-213.gf-vscode) by Andreas Källberg. +This provides syntax highlighting and a client for the Grammatical Framework language server. Follow the installation instructions in the link. +* [Grammatical Framework](https://marketplace.visualstudio.com/items?itemName=GrammaticalFramework.gf-vscode) is a simpler extension +without any external dependencies which provides only syntax highlighting. + +## Eclipse + +[GF Eclipse Plugin](https://github.com/GrammaticalFramework/gf-eclipse-plugin/), by John J. Camilleri + +## Gedit + +By John J. Camilleri + +Copy the file below to +`~/.local/share/gtksourceview-3.0/language-specs/gf.lang` (under Ubuntu). + + * [gf.lang](../src/tools/gf.lang) + +Some helpful notes/links: + + * The code is based heavily on the `haskell.lang` file which I found in +`/usr/share/gtksourceview-2.0/language-specs/haskell.lang`. + * Ruslan Osmanov recommends +[registering your file extension as its own MIME type](http://osmanov-dev-notes.blogspot.com/2011/04/how-to-add-new-highlight-mode-in-gedit.html) +(see also [here](https://help.ubuntu.com/community/AddingMimeTypes)), +however on my system the `.gf` extension was already registered +as a generic font (`application/x-tex-gf`) and I didn't want to risk +messing any of that up. + * This is a quick 5-minute job and might require some tweaking. +[The GtkSourceView language definition tutorial](http://developer.gnome.org/gtksourceview/stable/lang-tutorial.html) +is the place to start looking. + * Contributions are welcome! + +## Geany + +By John J. Camilleri + +[Custom filetype](http://www.geany.org/manual/dev/index.html#custom-filetypes) +config files for syntax highlighting in [Geany](http://www.geany.org/). + +For version 1.36 and above, copy one of the files below to +`/usr/share/geany/filedefs/filetypes.GF.conf` (under Ubuntu). +If you're using a version older than 1.36, copy the file to `/usr/share/geany/filetypes.GF.conf`. +You will need to manually create the file. + + * [light-filetypes.GF.conf](../src/tools/light-filetypes.GF.conf) + * [dark-filetypes.GF.conf](../src/tools/dark-filetypes.GF.conf) + +You will also need to edit the `filetype_extensions.conf` file and add the +following line somewhere: + +``` +GF=*.gf +``` + +## Vim + +[vim-gf](https://github.com/gdetrez/vim-gf)
\ No newline at end of file diff --git a/doc/gf-editor-modes.t2t b/doc/gf-editor-modes.t2t deleted file mode 100644 index 4ff15520d..000000000 --- a/doc/gf-editor-modes.t2t +++ /dev/null @@ -1,81 +0,0 @@ -Editor modes & IDE integration for GF - - -We collect GF modes for various editors on this page. Contributions are -welcome! - - -==Emacs== - -[gf.el https://github.com/GrammaticalFramework/gf-emacs-mode] by Johan -Bockgård provides syntax highlighting and automatic indentation and -lets you run the GF Shell in an emacs buffer. See installation -instructions inside. - -==Atom== -[language-gf https://atom.io/packages/language-gf], by John J. Camilleri - -==Visual Studio Code== - -- [Grammatical Framework Language Server https://marketplace.visualstudio.com/items?itemName=anka-213.gf-vscode] by Andreas Källberg. - This provides syntax highlighting and a client for the Grammatical Framework language server. Follow the installation instructions in the link. -- [Grammatical Framework https://marketplace.visualstudio.com/items?itemName=GrammaticalFramework.gf-vscode] is a simpler extension - without any external dependencies which provides only syntax highlighting. - -==Eclipse== - -[GF Eclipse Plugin https://github.com/GrammaticalFramework/gf-eclipse-plugin/], by John J. Camilleri - -==Gedit== - -By John J. Camilleri - -Copy the file below to -``~/.local/share/gtksourceview-3.0/language-specs/gf.lang`` (under Ubuntu). - -- [gf.lang ../src/tools/gf.lang] - - -Some helpful notes/links: - -- The code is based heavily on the ``haskell.lang`` file which I found in - ``/usr/share/gtksourceview-2.0/language-specs/haskell.lang``. -- Ruslan Osmanov recommends - [registering your file extension as its own MIME type http://osmanov-dev-notes.blogspot.com/2011/04/how-to-add-new-highlight-mode-in-gedit.html] - (see also [here https://help.ubuntu.com/community/AddingMimeTypes]), - however on my system the ``.gf`` extension was already registered - as a generic font (``application/x-tex-gf``) and I didn't want to risk - messing any of that up. -- This is a quick 5-minute job and might require some tweaking. - [The GtkSourceView language definition tutorial http://developer.gnome.org/gtksourceview/stable/lang-tutorial.html] - is the place to start looking. -- Contributions are welcome! - - -==Geany== - -By John J. Camilleri - -[Custom filetype http://www.geany.org/manual/dev/index.html#custom-filetypes] -config files for syntax highlighting in [Geany http://www.geany.org/]. - -For version 1.36 and above, copy one of the files below to -``/usr/share/geany/filedefs/filetypes.GF.conf`` (under Ubuntu). -If you're using a version older than 1.36, copy the file to ``/usr/share/geany/filetypes.GF.conf``. -You will need to manually create the file. - -- [light-filetypes.GF.conf ../src/tools/light-filetypes.GF.conf] -- [dark-filetypes.GF.conf ../src/tools/dark-filetypes.GF.conf] - - -You will also need to edit the ``filetype_extensions.conf`` file and add the -following line somewhere: - -``` -GF=*.gf -``` - - -==Vim== - -[vim-gf https://github.com/gdetrez/vim-gf] diff --git a/doc/gf-help-full.txt b/doc/gf-help-full.txt index 1b9c31705..3444a1c1a 100644 --- a/doc/gf-help-full.txt +++ b/doc/gf-help-full.txt @@ -46,7 +46,7 @@ #TINY The command has one argument which is either function, expression or -a category defined in the abstract syntax of the current grammar. +a category defined in the abstract syntax of the current grammar. If the argument is a function then ?its type is printed out. If it is a category then the category definition is printed. If a whole expression is given it prints the expression with refined @@ -303,7 +303,7 @@ but the resulting .gf file must be imported separately. #TINY -Generates a list of random trees, by default one tree. +Generates a list of random trees, by default one tree up to depth 5. If a tree argument is given, the command completes the Tree with values to all metavariables in the tree. The generation can be biased by probabilities, given in a file in the -probs flag. @@ -315,13 +315,14 @@ given in a file in the -probs flag. | ``-cat`` | generation category | ``-lang`` | uses only functions that have linearizations in all these languages | ``-number`` | number of trees generated - | ``-depth`` | the maximum generation depth + | ``-depth`` | the maximum generation depth (default: 5) | ``-probs`` | file with biased probabilities (format 'f 0.4' one by line) - Examples: | ``gr`` | one tree in the startcat of the current grammar | ``gr -cat=NP -number=16`` | 16 trees in the category NP + | ``gr -cat=NP -depth=2`` | one tree in the category NP, up to depth 2 | ``gr -lang=LangHin,LangTha -cat=Cl`` | Cl, both in LangHin and LangTha | ``gr -probs=FILE`` | generate with bias | ``gr (AdjCN ? (UseN ?))`` | generate trees of form (AdjCN ? (UseN ?)) @@ -338,8 +339,8 @@ given in a file in the -probs flag. #TINY -Generates all trees of a given category. By default, -the depth is limited to 4, but this can be changed by a flag. +Generates all trees of a given category. By default, +the depth is limited to 5, but this can be changed by a flag. If a Tree argument is given, the command completes the Tree with values to all metavariables in the tree. @@ -353,7 +354,7 @@ to all metavariables in the tree. - Examples: - | ``gt`` | all trees in the startcat, to depth 4 + | ``gt`` | all trees in the startcat, to depth 5 | ``gt -cat=NP -number=16`` | 16 trees in the category NP | ``gt -cat=NP -depth=2`` | trees in the category NP to depth 2 | ``gt (AdjCN ? (UseN ?))`` | trees of form (AdjCN ? (UseN ?)) @@ -582,7 +583,7 @@ trees where a function node is a metavariable. - Examples: - | ``l -lang=LangSwe,LangNor -chunks ? a b (? c d)`` | + | ``l -lang=LangSwe,LangNor -chunks ? a b (? c d)`` | #NORMAL @@ -647,7 +648,7 @@ The -lang flag can be used to restrict this to fewer languages. The default start category can be overridden by the -cat flag. See also the ps command for lexing and character encoding. -The -openclass flag is experimental and allows some robustness in +The -openclass flag is experimental and allows some robustness in the parser. For example if -openclass="A,N,V" is given, the parser will accept unknown adjectives, nouns and verbs with the resource grammar. diff --git a/doc/tutorial/gf-tutorial.t2t b/doc/tutorial/gf-tutorial.t2t index c4ccb6aab..d58b93f16 100644 --- a/doc/tutorial/gf-tutorial.t2t +++ b/doc/tutorial/gf-tutorial.t2t @@ -1188,7 +1188,7 @@ use ``generate_trees = gt``. this wine is fresh this wine is warm ``` -The default **depth** is 3; the depth can be +The default **depth** is 5; the depth can be set by using the ``depth`` flag: ``` > generate_trees -depth=2 | l @@ -1739,9 +1739,9 @@ A new module can **extend** an old one: Pizza : Kind ; } ``` -Note that the extended grammar doesn't inherit the start -category from the grammar it extends, so if you want to -generate sentences with this grammar, you'll have to either +Note that the extended grammar doesn't inherit the start +category from the grammar it extends, so if you want to +generate sentences with this grammar, you'll have to either add a startcat (e.g. ``flags startcat = Question ;``), or in the GF shell, specify the category to ``generate_random`` or ``geneate_trees`` (e.g. ``gr -cat=Comment`` or ``gt -cat=Question``). @@ -3746,7 +3746,7 @@ However, type-incorrect commands are rejected by the typecheck: The parsing is successful but the type checking failed with error(s): Couldn't match expected type Device light against the interred type Device fan - In the expression: DKindOne fan + In the expression: DKindOne fan ``` #NEW @@ -4184,7 +4184,7 @@ division of integers. ``` abstract Calculator = { flags startcat = Exp ; - + cat Exp ; fun |
