change minitranslator to use MicroLang

This commit is contained in:
aarneranta
2021-05-26 08:50:08 +02:00
parent 3dfd6730f8
commit aedaee8312
3 changed files with 7 additions and 4 deletions

View File

@@ -1,5 +1,8 @@
microlang:
gf -make ../lab2/grammar/english/MicroLangEng.gf ../lab2/grammar/functor/MicroLangFunctorSwe.gf
minilang: minilang:
gf -make ../lab2/grammar/english/MiniLangEng.gf ../lab2/grammar/swedish/MiniLangSwe.gf gf -make ../lab2/grammar/english/MiniLangEng.gf ../lab2/grammar/functor/MiniLangFunctorSwe.gf
query: query:
gf -make QueryEng.gf QuerySwe.gf gf -make QueryEng.gf QuerySwe.gf

View File

@@ -30,7 +30,7 @@ A minimal translator can be found in
[`minitranslator.py`](./minitranslator.py) [`minitranslator.py`](./minitranslator.py)
This program reads one line of input and translates it from English to Swedish by using `MiniGrammar.pgf`. Example: This program reads one line of input and translates it from English to Swedish by using `MicroGrammar.pgf`. Example:
``` ```
$ echo "the cat is black" | python3 minitranslator.py $ echo "the cat is black" | python3 minitranslator.py
katten är svart katten är svart

View File

@@ -4,9 +4,9 @@
import pgf import pgf
# change these three to translate with other grammars and languages # change these three to translate with other grammars and languages
absmodule = "MiniLang" absmodule = "MicroLang"
fromname = absmodule + "Eng" fromname = absmodule + "Eng"
toname = absmodule + "Swe" toname = absmodule + "FunctorSwe"
def main(): def main():
# read in the grammar, set up to and from languages # read in the grammar, set up to and from languages