1
0
forked from GitHub/gf-rgl

Merge branch 'master' of github.com:GrammaticalFramework/gf-rgl

This commit is contained in:
Krasimir Angelov
2025-08-18 19:14:13 +02:00
6 changed files with 95 additions and 66 deletions

View File

@@ -21,7 +21,7 @@ jobs:
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'GrammaticalFramework/gf-core'
version: 'tags/${{ env.GF_VERSION }}'
version: 'tags/release-${{ env.GF_VERSION }}'
file: 'gf-${{ env.GF_VERSION }}-ubuntu-24.04.deb'
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -25,6 +25,7 @@ data LangInfo = LangInfo
, langSymbolic :: Bool
, langCompatibility :: Bool
, langSynopsis :: Bool -- ^ include in RGL synopsis
, langMorphodict :: Bool
} deriving (Show,Eq)
-- | Load language information from default config file
@@ -55,6 +56,7 @@ loadLangsFrom configFile = do
, langSymbolic = boolBit bits 8 True
, langCompatibility = boolBit bits 9 False
, langSynopsis = boolBit bits 10 False
, langMorphodict = boolBit bits 11 False
}
-- | Separate a string on a character

View File

@@ -19,6 +19,7 @@ default: build copy
build: src/*/*.gf
ifneq (, $(RUNGHC))
$(RUNGHC) build
$(RUNGHC) build morphodict
else
./Setup.sh
endif
@@ -26,6 +27,7 @@ endif
copy:
ifneq (, $(RUNGHC))
$(RUNGHC) copy
$(RUNGHC) copy morphodict
endif
install: build copy

View File

@@ -1,4 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE CPP, LambdaCase #-}
-- | Main build script for RGL
@@ -150,11 +150,12 @@ getRGLBuildSubDir mode =
case mode of
Present -> "present"
AllTenses -> "alltenses"
MorphoDict -> "morphodict"
-------------------------------------------------------------------------------
-- Build modes
data Mode = Present | AllTenses
data Mode = Present | AllTenses | MorphoDict
deriving (Show,Eq)
all_modes :: [String]
@@ -187,6 +188,7 @@ rglCommands =
, RGLCommand "lang" False $ gfcp [l,s]
, RGLCommand "api" False $ gfcp [t,sc]
, RGLCommand "compat" False $ gfcp [c]
, RGLCommand "morphodict" False $ gfcp [m]
-- Special command, invoked when command ends in .gf
, RGLCommand "modules" False $ \modes args bi -> do
@@ -223,14 +225,20 @@ rglCommands =
s mode args = (symbol,optml mode langTry args)
c mode args = (compat,optml AllTenses langCompatibility args)
t mode args = (try,optml mode langTry args)
m mode args = (morphodict,optml mode langMorphodict args)
sc mode args = (symbolic,optml mode langSymbolic args)
optml :: Mode -> (LangInfo -> Bool) -> [String] -> ([LangInfo] -> [LangInfo])
optml mode pred args =
\langsAll ->
let langsDefault = filter (if mode == Present then langPresent else const True) (filter pred langsAll)
let langsDefault = filter (mode2langinfo mode) (filter pred langsAll)
in getOptLangs langsAll langsDefault args
mode2langinfo = \case
Present -> langPresent
MorphoDict -> langMorphodict
_ -> const True
-------------------------------------------------------------------------------
-- Getting module paths/names
@@ -260,6 +268,9 @@ syntax l = sourceDir </> "api" </> ("Syntax" ++ langCode l ++ ".gf")
symbolic :: LangInfo -> FilePath
symbolic l = sourceDir </> "api" </> ("Symbolic" ++ langCode l ++ ".gf")
morphodict :: LangInfo -> FilePath
morphodict l = sourceDir </> "morphodict" </> ("MorphoDict" ++ langCode l ++ ".gf")
-------------------------------------------------------------------------------
-- Argument helpers
@@ -302,8 +313,9 @@ getOptMode args =
else explicit_modes
where
explicit_modes =
[Present|have "present"]++
[AllTenses|have "alltenses"]
[Present | have "present"] ++
[AllTenses | have "alltenses"] ++
[MorphoDict | have "morphodict"]
have mode = mode `elem` args
-- | List of languages overriding the default definitions
@@ -366,8 +378,8 @@ gfcn :: Info -> Mode -> String -> [FilePath] -> IO ()
gfcn bi mode summary files = do
let dir = getRGLBuildDir bi mode
preproc = case mode of
Present -> "--preproc=mkPresent"
AllTenses -> ""
Present -> "--preproc=mkPresent"
_ -> ""
createDirectoryIfMissing True dir
if length files > 0
then do

View File

@@ -59,6 +59,7 @@ gfc="${gf} --batch --quiet --gf-lib-path=${dist}"
mkdir -p "${dist}/prelude"
mkdir -p "${dist}/present"
mkdir -p "${dist}/alltenses"
mkdir -p "${dist}/morphodict"
# Build: prelude
echo "Building [prelude]"
@@ -68,6 +69,7 @@ ${gfc} --gfo-dir="${dist}"/prelude "${src}"/prelude/*.gf
# Gather all language modules for building
modules_present=
modules_alltenses=
modules_morphodict=
for lang in $langs; do
for mod in $modules_langs $modules_api; do
if [ $mod == "Compatibility" ] && [[ "$langs_compat" != *"$lang"* ]]; then continue; fi
@@ -80,8 +82,12 @@ for lang in $langs; do
modules_alltenses="${modules_alltenses} ${file}"
done
done
file="${src}/morphodict/MorphoDict${lang}.gf"
if [ ! -f "$file" ]; then continue; fi
modules_morphodict="${modules_morphodict} ${file}"
done
# Build: present
echo "Building [present]"
if [ $verbose = true ]; then echo $modules_present; fi
@@ -96,6 +102,13 @@ for module in $modules_alltenses; do
${gfc} --no-pmcfg --gfo-dir="${dist}"/alltenses "${module}"
done
# Build: morphodict
echo "Building [morphodict]"
if [ $verbose = true ]; then echo $modules_morphodict; fi
for module in $modules_morphodict; do
${gfc} --no-pmcfg --gfo-dir="${dist}"/morphodict "${module}"
done
# Copy
if [ $dest == $dist ]; then exit 0; fi
echo "Copying to ${dest}"

View File

@@ -1,58 +1,58 @@
Code,Name,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility,Synopsis
Afr,Afrikaans,afrikaans,,,,,,n,,y
Amh,Amharic,amharic,,,,,n,n,,n
Ara,Arabic,arabic,,,,,,y,,y
Bul,Bulgarian,bulgarian,,,y,,,,,y
Cat,Catalan,catalan,Romance,,y,,,,y,y
Cgg,Rukiga,rukiga,,,y,y,n,n,y,y
Chi,Chinese (simplified),chinese,,,,,,,,y
Cze,Czech,czech,,,,,,n,,y
Dan,Danish,danish,Scand,,y,,,,,y
Dut,Dutch,dutch,,,y,,,,,y
Eng,English,english,,,y,,,,y,y
Est,Estonian,estonian,,,,,,,,y
Eus,Basque,basque,,,,,,,,y
Fin,Finnish,finnish,,,y,,,,y,y
Fre,French,french,Romance,,y,,,,y,y
Ger,German,german,,,y,,,,,y
Grc,Ancient Greek,ancient_greek,,,y,,n,n,,n
Gre,Greek,greek,,,,,,,,y
Heb,Hebrew,hebrew,,,,,n,n,,n
Hin,Hindi,hindi,Hindustani,to_devanagari,y,,,,,y
Hrv,Croatian,croatian,,,,,,y,,n
Hun,Hungarian,hungarian,,,n,y,y,y,n,n
Ice,Icelandic,icelandic,,,,,,n,,y
Ina,Interlingua,interlingua,,,y,,n,n,,n
Ita,Italian,italian,Romance,,y,,,,y,y
Jpn,Japanese,japanese,,,,,,,,y
Kaz,Kazakh,kazakh,,,,y,n,n,n,y
Kor,Korean,korean,,,n,y,y,y,n,n
Lat,Latin,latin,,,,,y,y,n,y
Lav,Latvian,latvian,,,,,,,y,y
Mkd,Macedonian,macedonian,,,,y,n,n,n,y
May,Malay,malay,,,y,,,,n,y
Mlt,Maltese,maltese,,,,,,,,y
Mon,Mongolian,mongolian,,,,,,n,,y
Nep,Nepali,nepali,,,,,,n,,y
Nno,Norwegian (nynorsk),nynorsk,,,y,,,,,y
Nor,Norwegian (bokmål),norwegian,Scand,,y,,,,,y
Pes,Persian,persian,,,,,,,,y
Pnb,Punjabi,punjabi,,,y,,,,,y
Pol,Polish,polish,,,,,,,,y
Por,Portuguese,portuguese,Romance,,y,,,,y,y
Ron,Romanian,romanian,,,y,,,,,y
Rus,Russian,russian,,,y,,,,,y
Slo,Slovak,slovak,,,,,,n,,y
Slv,Slovenian,slovenian,,,,,n,n,,n
Snd,Sindhi,sindhi,,,,,,,,y
Spa,Spanish,spanish,Romance,,y,,,,y,y
Sqi,Albanian,albanian,,,,y,n,n,n,y
Swa,Swahili,swahili,Bantu,,,y,n,n,n,n
Swe,Swedish,swedish,Scand,,y,,,,y,y
Tam,Tamil,tamil,n,n,n,n,n,n,n,n
Tel,Telugu,telugu,,,y,n,n,n,,n
Tha,Thai,thai,,to_thai,,,,,,y
Tur,Turkish,turkish,,,y,,,n,,n
Urd,Urdu,urdu,Hindustani,,,,,,,y
Som,Somali,somali,,,,,n,n,,n
Zul,Zulu,zulu,,,,,n,n,,n
Code,Name,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility,Synopsis,MorphoDict
Afr,Afrikaans,afrikaans,,,,,,n,,y,n
Amh,Amharic,amharic,,,,,n,n,,n,n
Ara,Arabic,arabic,,,,,,y,,y,y
Bul,Bulgarian,bulgarian,,,y,,,,,y,n
Cat,Catalan,catalan,Romance,,y,,,,y,y,n
Cgg,Rukiga,rukiga,,,y,y,n,n,y,y,n
Chi,Chinese (simplified),chinese,,,,,,,,y,y
Cze,Czech,czech,,,,,,n,,y,n
Dan,Danish,danish,Scand,,y,,,,,y,n
Dut,Dutch,dutch,,,y,,,,,y,n
Eng,English,english,,,y,,,,y,y,y
Est,Estonian,estonian,,,,,,,,y,n
Eus,Basque,basque,,,,,,,,y,n
Fin,Finnish,finnish,,,y,,,,y,y,y
Fre,French,french,Romance,,y,,,,y,y,y
Ger,German,german,,,y,,,,,y,y
Grc,Ancient Greek,ancient_greek,,,y,,n,n,,n,n
Gre,Greek,greek,,,,,,,,y,n
Heb,Hebrew,hebrew,,,,,n,n,,n,n
Hin,Hindi,hindi,Hindustani,to_devanagari,y,,,,,y,n
Hrv,Croatian,croatian,,,,,,y,,n,n
Hun,Hungarian,hungarian,,,n,y,y,y,n,n,n
Ice,Icelandic,icelandic,,,,,,n,,y,n
Ina,Interlingua,interlingua,,,y,,n,n,,n,n
Ita,Italian,italian,Romance,,y,,,,y,y,y
Jpn,Japanese,japanese,,,,,,,,y,n
Kaz,Kazakh,kazakh,,,,y,n,n,n,y,n
Kor,Korean,korean,,,n,y,y,y,n,n,n
Lat,Latin,latin,,,,,y,y,n,y,n
Lav,Latvian,latvian,,,,,,,y,y,n
Mkd,Macedonian,macedonian,,,,y,n,n,n,y,n
May,Malay,malay,,,y,,,,n,y,n
Mlt,Maltese,maltese,,,,,,,,y,n
Mon,Mongolian,mongolian,,,,,,n,,y,n
Nep,Nepali,nepali,,,,,,n,,y,n
Nno,Norwegian (nynorsk),nynorsk,,,y,,,,,y,n
Nor,Norwegian (bokmål),norwegian,Scand,,y,,,,,y,n
Pes,Persian,persian,,,,,,,,y,n
Pnb,Punjabi,punjabi,,,y,,,,,y,n
Pol,Polish,polish,,,,,,,,y,n
Por,Portuguese,portuguese,Romance,,y,,,,y,y,y
Ron,Romanian,romanian,,,y,,,,,y,n
Rus,Russian,russian,,,y,,,,,y,n
Slo,Slovak,slovak,,,,,,n,,y,n
Slv,Slovenian,slovenian,,,,,n,n,,n,n
Snd,Sindhi,sindhi,,,,,,,,y,n
Spa,Spanish,spanish,Romance,,y,,,,y,y,y
Sqi,Albanian,albanian,,,,y,n,n,n,y,n
Swa,Swahili,swahili,Bantu,,,y,n,n,n,n,n
Swe,Swedish,swedish,Scand,,y,,,,y,y,y
Tam,Tamil,tamil,n,n,n,n,n,n,n,n,n
Tel,Telugu,telugu,,,y,n,n,n,,n,n
Tha,Thai,thai,,to_thai,,,,,,y,n
Tur,Turkish,turkish,,,y,,,n,,n,n
Urd,Urdu,urdu,Hindustani,,,,,,,y,n
Som,Somali,somali,,,,,n,n,,n,n
Zul,Zulu,zulu,,,,,n,n,,n,n
1 Code Name Directory Functor Unlexer Present All Try Symbolic Compatibility Synopsis MorphoDict
2 Afr Afrikaans afrikaans n y n
3 Amh Amharic amharic n n n n
4 Ara Arabic arabic y y y
5 Bul Bulgarian bulgarian y y n
6 Cat Catalan catalan Romance y y y n
7 Cgg Rukiga rukiga y y n n y y n
8 Chi Chinese (simplified) chinese y y
9 Cze Czech czech n y n
10 Dan Danish danish Scand y y n
11 Dut Dutch dutch y y n
12 Eng English english y y y y
13 Est Estonian estonian y n
14 Eus Basque basque y n
15 Fin Finnish finnish y y y y
16 Fre French french Romance y y y y
17 Ger German german y y y
18 Grc Ancient Greek ancient_greek y n n n n
19 Gre Greek greek y n
20 Heb Hebrew hebrew n n n n
21 Hin Hindi hindi Hindustani to_devanagari y y n
22 Hrv Croatian croatian y n n
23 Hun Hungarian hungarian n y y y n n n
24 Ice Icelandic icelandic n y n
25 Ina Interlingua interlingua y n n n n
26 Ita Italian italian Romance y y y y
27 Jpn Japanese japanese y n
28 Kaz Kazakh kazakh y n n n y n
29 Kor Korean korean n y y y n n n
30 Lat Latin latin y y n y n
31 Lav Latvian latvian y y n
32 Mkd Macedonian macedonian y n n n y n
33 May Malay malay y n y n
34 Mlt Maltese maltese y n
35 Mon Mongolian mongolian n y n
36 Nep Nepali nepali n y n
37 Nno Norwegian (nynorsk) nynorsk y y n
38 Nor Norwegian (bokmål) norwegian Scand y y n
39 Pes Persian persian y n
40 Pnb Punjabi punjabi y y n
41 Pol Polish polish y n
42 Por Portuguese portuguese Romance y y y y
43 Ron Romanian romanian y y n
44 Rus Russian russian y y n
45 Slo Slovak slovak n y n
46 Slv Slovenian slovenian n n n n
47 Snd Sindhi sindhi y n
48 Spa Spanish spanish Romance y y y y
49 Sqi Albanian albanian y n n n y n
50 Swa Swahili swahili Bantu y n n n n n
51 Swe Swedish swedish Scand y y y y
52 Tam Tamil tamil n n n n n n n n n
53 Tel Telugu telugu y n n n n n
54 Tha Thai thai to_thai y n
55 Tur Turkish turkish y n n n
56 Urd Urdu urdu Hindustani y n
57 Som Somali somali n n n n
58 Zul Zulu zulu n n n n