[More info about SimpleDemo. bjorn@bringert.net**20050529164937] { hunk ./doc/gf-java.html 78 +

Producing a grammar for the interpreter

+ +

+The GF interpreter needs two representations of the grammar to do +linearization and parsing. These two representations can be generated +from a GF source grammar by using the +GF system. +This example assumes that we have the concrete syntax modules +TestEng and TestSwe. +

+ +
    + +
  1. +

    +Load all the source modules into GF: +

    +
    +> i TestEng.gf
    +> i TestSwe.gf
    +
    +
  2. +
  3. +

    +Create a GFCM file: +

    +
    +> pm -utf8 -utf8id -printer=header | wf test.gfcm
    +
    +
  4. +
  5. +

    +Create a CFGM file: +

    +
    +> pm -utf8 -utf8id -printer=cfgm | wf test.cfgm
    +
    +
  6. + +
  7. +

    +Create a properties file (here test.properties) so that the +interpreter can find these files. The file should have these contents: +

    +
    +name: test
    +gfcm: test.gfcm
    +cfgm: test.cfgm
    +
    +
  8. + +
+ +

See the +build-translet +script for an example of how to do this automatically.

+ hunk ./doc/gf-java.html 178 -href="http://www.cs.chalmers.se/~bringert/darcs/simpledemo/src/SimpleDemoText.java">SimpleDemoText.java. +href="http://www.cs.chalmers.se/~bringert/darcs/simpledemo/src/SimpleDemoText.java">SimpleDemoText.java. This examples uses +these grammars. There is a Darcs repo for the complete demo program. hunk ./doc/gf-java.html 196 - -

Producing a grammar for the interpreter

- -

-The GF interpreter needs two representations of the grammar to do -linearization and parsing. These two representations can be generated -from a GF source grammar by using the -GF system. -This example assumes that we have the concrete syntax modules -TestEng and TestSwe. -

- -
    - -
  1. -

    -Load all the source modules into GF: -

    -
    -> i TestEng.gf
    -> i TestSwe.gf
    -
    -
  2. -
  3. -

    -Create a GFCM file: -

    -
    -> pm -utf8 -utf8id -printer=header | wf test.gfcm
    -
    -
  4. -
  5. -

    -Create a CFGM file: -

    -
    -> pm -utf8 -utf8id -printer=cfgm | wf test.cfgm
    -
    -
  6. - -
  7. -

    -Create a properties file (here test.properties) so that the interpreter can find -these files. The file should have these contents: -

    -
    -name: test
    -gfcm: test.gfcm
    -cfgm: test.cfgm
    -
    -
  8. - -
- -

See the -build-translet -script for an example of how to do this automatically.

}