mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 01:22:51 -06:00
remove -src from Setup; simplified str2numeral; bug fix in Finnish ordinal inflection
This commit is contained in:
9
Setup.hs
9
Setup.hs
@@ -60,7 +60,7 @@ rglCommands =
|
|||||||
mapM_ (gfc mode pkg lbi . compat) (optl langsCompat args)
|
mapM_ (gfc mode pkg lbi . compat) (optl langsCompat args)
|
||||||
, RGLCommand "api" True $ \mode args pkg lbi -> do
|
, RGLCommand "api" True $ \mode args pkg lbi -> do
|
||||||
mapM_ (gfc mode pkg lbi . try) (optl langsAPI args)
|
mapM_ (gfc mode pkg lbi . try) (optl langsAPI args)
|
||||||
mapM_ (gfc mode pkg lbi . symbolic) (optl langsAPI args)
|
mapM_ (gfc mode pkg lbi . symbolic) (optl langsSymbolic args)
|
||||||
, RGLCommand "pgf" False $ \mode args pkg lbi -> do
|
, RGLCommand "pgf" False $ \mode args pkg lbi -> do
|
||||||
let dir = getRGLBuildDir lbi mode
|
let dir = getRGLBuildDir lbi mode
|
||||||
createDirectoryIfMissing True dir
|
createDirectoryIfMissing True dir
|
||||||
@@ -208,7 +208,10 @@ langs = map fst langsCoding
|
|||||||
langsLang = langs `except` ["Amh","Ara","Lat","Hin","Tha","Tur","Urd"]
|
langsLang = langs `except` ["Amh","Ara","Lat","Hin","Tha","Tur","Urd"]
|
||||||
|
|
||||||
-- languages for which to compile Try
|
-- languages for which to compile Try
|
||||||
langsAPI = langsLang `except` ["Hin","Ina","Rus","Tha"]
|
langsAPI = langsLang `except` ["Hin","Ina","Tha"]
|
||||||
|
|
||||||
|
-- languages for which to compile Symbolic
|
||||||
|
langsSymbolic = langsAPI `except` ["Rus"]
|
||||||
|
|
||||||
-- languages for which to run demo test
|
-- languages for which to run demo test
|
||||||
langsDemo = langsLang `except` ["Ara","Hin","Ina","Tha"]
|
langsDemo = langsLang `except` ["Ara","Hin","Ina","Tha"]
|
||||||
@@ -310,7 +313,7 @@ unlexer abstr ls =
|
|||||||
-- | Runs the gf executable in compile mode with the given arguments.
|
-- | Runs the gf executable in compile mode with the given arguments.
|
||||||
run_gfc :: PackageDescription -> LocalBuildInfo -> [String] -> IO ()
|
run_gfc :: PackageDescription -> LocalBuildInfo -> [String] -> IO ()
|
||||||
run_gfc pkg lbi args =
|
run_gfc pkg lbi args =
|
||||||
do let args' = ["-batch","-src","-gf-lib-path="++rgl_src_dir,"+RTS","-K32M","-RTS"] ++ filter (not . null) args
|
do let args' = ["-batch","-gf-lib-path="++rgl_src_dir,"+RTS","-K32M","-RTS"] ++ filter (not . null) args
|
||||||
gf = default_gf pkg lbi
|
gf = default_gf pkg lbi
|
||||||
putStrLn $ "Running: " ++ gf ++ " " ++ unwords (map showArg args')
|
putStrLn $ "Running: " ++ gf ++ " " ++ unwords (map showArg args')
|
||||||
e <- rawSystem gf args'
|
e <- rawSystem gf args'
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ gfc pres ppath file = do
|
|||||||
let preproc = if pres then "-preproc=mkPresent" else ""
|
let preproc = if pres then "-preproc=mkPresent" else ""
|
||||||
let path = if pres then ppath else ""
|
let path = if pres then ppath else ""
|
||||||
putStrLn $ "Compiling " ++ file
|
putStrLn $ "Compiling " ++ file
|
||||||
run_gfc ["-s","-src", preproc, path, file]
|
run_gfc ["-s","-src",preproc, path, file]
|
||||||
|
|
||||||
gfcmin path file = do
|
gfcmin path file = do
|
||||||
let preproc = "-preproc=mkMinimal"
|
let preproc = "-preproc=mkMinimal"
|
||||||
|
|||||||
@@ -1646,13 +1646,18 @@ oper
|
|||||||
Predef.PFalse => NumDigits (str2digits s)
|
Predef.PFalse => NumDigits (str2digits s)
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
str2numeral : Str -> Numeral = (\s -> case s of {
|
str2numeral : Str -> Numeral =
|
||||||
m@(? + _) + "000" => num (pot3 (s2s1000 m)) ;
|
(\s -> case s of {
|
||||||
m@(? + _) + "00" + n@? => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
|
? => num (pot2as3 (pot1as2 (pot0as1 (s2s10 s)))) ;
|
||||||
m@(? + _) + "0" + n@(? + ?) => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
|
? + ? => num (pot2as3 (pot1as2 (s2s100 s))) ;
|
||||||
m@(? + _) + n@(? + ? + ?) => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
|
|
||||||
_ => num (pot2as3 (s2s1000 s))
|
-- m@(? + _) + "000" => num (pot3 (s2s1000 m)) ;
|
||||||
})
|
-- m@(? + _) + "00" + n@? => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
|
||||||
|
-- m@(? + _) + "0" + n@(? + ?) => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
|
||||||
|
-- m@(? + _) + n@(? + ? + ?) => num (pot3plus (s2s1000 m) (s2s1000 n)) ;
|
||||||
|
-- _ => num (pot2as3 (s2s1000 s))
|
||||||
|
_ => Predef.error ("no numeral for string" ++ s)
|
||||||
|
})
|
||||||
where {
|
where {
|
||||||
|
|
||||||
s2d : Str -> Digit = \s -> case s of {
|
s2d : Str -> Digit = \s -> case s of {
|
||||||
@@ -1681,13 +1686,14 @@ oper
|
|||||||
d@#idigit + n@? => pot1plus (s2d d) (s2s10 n) ;
|
d@#idigit + n@? => pot1plus (s2d d) (s2s10 n) ;
|
||||||
_ => pot0as1 (s2s10 s)
|
_ => pot0as1 (s2s10 s)
|
||||||
} ;
|
} ;
|
||||||
|
{-
|
||||||
s2s1000 : Str -> Sub1000 = \s -> case s of {
|
s2s1000 : Str -> Sub1000 = \s -> case s of {
|
||||||
d@? + "00" => pot2 (s2s10 d) ;
|
d@? + "00" => pot2 (s2s10 d) ;
|
||||||
d@? + "0" + n@? => pot2plus (s2s10 d) (s2s100 n) ;
|
d@? + "0" + n@? => pot2plus (s2s10 d) (s2s100 n) ;
|
||||||
d@? + n@(? + ?) => pot2plus (s2s10 d) (s2s100 n) ;
|
d@? + n@(? + ?) => pot2plus (s2s10 d) (s2s100 n) ;
|
||||||
_ => pot1as2 (s2s100 s)
|
_ => pot1as2 (s2s100 s)
|
||||||
} ;
|
} ;
|
||||||
|
-}
|
||||||
} ;
|
} ;
|
||||||
idigit : pattern Str = #("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9") ;
|
idigit : pattern Str = #("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9") ;
|
||||||
digit : pattern Str = #("0" | #idigit) ;
|
digit : pattern Str = #("0" | #idigit) ;
|
||||||
|
|||||||
@@ -91,9 +91,9 @@ oper
|
|||||||
sada = init sadas
|
sada = init sadas
|
||||||
in
|
in
|
||||||
mkN
|
mkN
|
||||||
sadas (sada + "nnen") (sada + "nten" + a) (sada + "tt" + a) (sada + "nteen")
|
sadas (sada + "nnen") (sada + "tt" + a) (sada + "nten" + a) (sada + "nteen")
|
||||||
(sada + "nsin" + a) (sada + "nsiss" + a) (sada + "nsien")
|
(sada + "nsien") (sada + "nsi" + a) (sada + "nsin" + a)
|
||||||
(sada + "nsi" + a) (sada + "nsiin") ;
|
(sada + "nsiss" + a) (sada + "nsiin") ;
|
||||||
|
|
||||||
param
|
param
|
||||||
NumPlace = NumIndep | NumAttr ;
|
NumPlace = NumIndep | NumAttr ;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ oper
|
|||||||
mkN : (savi,savia : Str) -> N ; -- different pl.part
|
mkN : (savi,savia : Str) -> N ; -- different pl.part
|
||||||
mkN : (vesi,veden,vesiä : Str) -> N ; -- also different sg.gen
|
mkN : (vesi,veden,vesiä : Str) -> N ; -- also different sg.gen
|
||||||
mkN : (vesi,veden,vesiä,vettä : Str) -> N ; -- also different sg.part
|
mkN : (vesi,veden,vesiä,vettä : Str) -> N ; -- also different sg.part
|
||||||
mkN : (olo,n,na,a,oon,jen,ja,ina,issa,ihin : Str) -> N ; -- worst case, 10 forms
|
mkN : (olo,n,a,na,oon,jen,ja,ina,issa,ihin : Str) -> N ; -- worst case, 10 forms
|
||||||
mkN : (pika : Str) -> (juna : N) -> N ; -- compound with invariable prefix
|
mkN : (pika : Str) -> (juna : N) -> N ; -- compound with invariable prefix
|
||||||
mkN : (oma : N) -> (tunto : N) -> N ; -- compound with inflecting prefix
|
mkN : (oma : N) -> (tunto : N) -> N ; -- compound with inflecting prefix
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
Reference in New Issue
Block a user