forked from GitHub/gf-core
simplified 1.5 by removing mathematical/
This commit is contained in:
@@ -49,14 +49,11 @@ langsCoding = [
|
||||
langs = map fst langsCoding
|
||||
|
||||
-- languagues for which to compile Lang
|
||||
langsLang = langs `except` ["Ara"]
|
||||
langsLang = langs `except` ["Ara","Bul","Ina","Rus"]
|
||||
|
||||
-- languages for which to compile Try
|
||||
langsAPI = langsLang `except` ["Ara","Bul","Hin","Ina","Rus","Tha"]
|
||||
|
||||
-- languages for which to compile Mathematical
|
||||
langsMath = langsAPI
|
||||
|
||||
-- languages for which to run treebank test
|
||||
langsTest = langsLang `except` ["Ara","Bul","Cat","Hin","Rus","Spa","Tha"]
|
||||
|
||||
@@ -88,17 +85,10 @@ make xx = do
|
||||
ifx "lang" $ do
|
||||
mapM_ (gfc pres [] . lang) (optl langsLang)
|
||||
copy "*/*.gfo" dir
|
||||
ifx "compat" $ do
|
||||
mapM_ (gfc pres [] . compat) (optl langsCompat)
|
||||
copy "*/Compatibility*.gfo" dir
|
||||
ifx "api" $ do
|
||||
mapM_ (gfc pres presApiPath . try) (optl langsAPI)
|
||||
mapM_ (gfc pres presApiPath . symbolic) (optl langsAPI)
|
||||
copy "*/*.gfo" dir
|
||||
ifx "math" $ do
|
||||
mapM_ (gfc False [] . math) (optl langsMath)
|
||||
copy "mathematical/*.gfo" "../mathematical"
|
||||
mapM_ (gfc False [] . symbolic) (optl langsMath)
|
||||
copy "mathematical/Symbolic*.gfo" "../mathematical"
|
||||
ifxx "pgf" $ do
|
||||
run_gfc $ ["-s","--make","--name=langs","--parser=off",
|
||||
"--output-dir=" ++ dir]
|
||||
@@ -138,10 +128,8 @@ demos abstr ls = "gr -number=100 | l -treebank " ++ unlexer abstr ls ++
|
||||
" | ps -to_html | wf -file=resdemo.html"
|
||||
|
||||
lang (lla,la) = lla ++ "/All" ++ la ++ ".gf"
|
||||
compat (lla,la) = lla ++ "/Compatibility" ++ la ++ ".gf"
|
||||
try (lla,la) = "api/Try" ++ la ++ ".gf"
|
||||
math (lla,la) = "mathematical/Mathematical" ++ la ++ ".gf"
|
||||
symbolic (lla,la) = "mathematical/Symbolic" ++ la ++ ".gf"
|
||||
symbolic (lla,la) = "api/Symbolic" ++ la ++ ".gf"
|
||||
|
||||
except ls es = filter (flip notElem es . snd) ls
|
||||
only ls es = filter (flip elem es . snd) ls
|
||||
|
||||
@@ -1510,7 +1510,8 @@ incomplete resource Constructors = open Grammar in {
|
||||
= \p,i -> TExclMark (PhrUtt NoPConj (UttImpSg p i) NoVoc) TEmpty;
|
||||
mkText : Phr -> Text -> Text -- John walks. ...
|
||||
= TFullStop ;
|
||||
mkText : Text -> Text -> Text = \t,u -> {s = t.s ++ u.s ; lock_Text = <>} ;
|
||||
mkText : Text -> Text -> Text
|
||||
= \t,u -> {s = t.s ++ u.s ; lock_Text = <>} ;
|
||||
} ;
|
||||
|
||||
mkVP = overload {
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
--1 Symbolic: Noun Phrases with mathematical symbols
|
||||
|
||||
incomplete resource Symbolic = open
|
||||
Symbol, Syntax, PredefCnc in {
|
||||
incomplete resource Symbolic = open Symbol, Grammar in {
|
||||
|
||||
oper
|
||||
symb : overload {
|
||||
symb : Str -> NP ; -- x
|
||||
symb : Int -> NP ; -- 23
|
||||
symb : Integer -> NP ; -- 23
|
||||
symb : Float -> NP ; -- 0.99
|
||||
symb : N -> Digits -> NP ; -- level 4
|
||||
symb : N -> Card -> NP ; -- level four
|
||||
@@ -14,49 +13,44 @@ incomplete resource Symbolic = open
|
||||
symb : Det -> N -> Card -> NP ; -- the number four
|
||||
symb : Det -> CN -> Card -> NP ; -- the even number four
|
||||
symb : Det -> N -> Str -> Str -> NP ; -- the levels i and j
|
||||
symb : Det -> CN -> [Symb] -> NP ; -- the basic levels i, j, and k
|
||||
symb : Symb -> S ; -- A
|
||||
symb : Symb -> Card ; -- n
|
||||
symb : Symb -> Ord -- n'th
|
||||
symb : Det -> CN -> [Symb] -> NP -- the basic levels i, j, and k
|
||||
} ;
|
||||
|
||||
mkSymb : Str -> Symb ;
|
||||
mkInt : Str -> PredefCnc.Int ;
|
||||
mkFloat : Str -> PredefCnc.Float ;
|
||||
mkSymb : Str -> Symb ;
|
||||
mkInteger : Predef.Int -> Integer ;
|
||||
mkFloating : Predef.Float -> Floating ;
|
||||
|
||||
--.
|
||||
|
||||
symb = overload {
|
||||
symb : Str -> NP
|
||||
= \s -> mkNP (SymbPN (mkSymb s)) ;
|
||||
symb : Int -> NP
|
||||
= \i -> mkNP (IntPN i) ;
|
||||
symb : Float -> NP
|
||||
= \i -> mkNP (FloatPN i) ;
|
||||
= \s -> UsePN (SymbPN (mkSymb s)) ;
|
||||
symb : Integer -> NP
|
||||
= \i -> UsePN (IntPN i) ;
|
||||
symb : Floating -> NP
|
||||
= \i -> UsePN (FloatPN i) ;
|
||||
symb : N -> Digits -> NP
|
||||
= \c,i -> CNNumNP (mkCN c) (mkCard i) ;
|
||||
= \c,i -> CNNumNP (UseN c) (NumDigits i) ;
|
||||
symb : N -> Card -> NP
|
||||
= \c,n -> CNNumNP (mkCN c) n ;
|
||||
= \c,n -> CNNumNP (UseN c) n ;
|
||||
symb : CN -> Card -> NP
|
||||
= \c,n -> CNNumNP c n ;
|
||||
symb : Det -> N -> Card -> NP
|
||||
= \d,n,x -> mkNP d (mkCN (mkCN n) (mkNP (NumPN x))) ;
|
||||
= \d,n,x -> DetCN d (ApposCN (UseN n) (UsePN (NumPN x))) ;
|
||||
symb : Det -> CN -> Card -> NP
|
||||
= \d,n,x -> mkNP d (mkCN n (mkNP (NumPN x))) ;
|
||||
= \d,n,x -> DetCN d (ApposCN n (UsePN (NumPN x))) ;
|
||||
symb : Det -> N -> Str -> Str -> NP
|
||||
= \c,n,x,y -> CNSymbNP c (mkCN n) (BaseSymb (mkSymb x) (mkSymb y)) ;
|
||||
= \c,n,x,y -> CNSymbNP c (UseN n) (BaseSymb (mkSymb x) (mkSymb y)) ;
|
||||
symb : Det -> CN -> [Symb] -> NP
|
||||
= CNSymbNP ;
|
||||
symb : Symb -> S = SymbS ;
|
||||
symb : Symb -> Card = SymbNum ;
|
||||
symb : Symb -> Ord = SymbOrd
|
||||
|
||||
= CNSymbNP
|
||||
} ;
|
||||
|
||||
mkSymb : Str -> Symb = \s -> {s = s ; lock_Symb = <>} ;
|
||||
|
||||
mkInt i = {s = i ; lock_Int = <>} ;
|
||||
mkFloat f = {s = f ; lock_Float = <>} ;
|
||||
mkInteger i = {s = Predef.show Predef.Int i ; lock_Int = <>} ;
|
||||
mkFloating f = {s = Predef.show Predef.Float f ; lock_Float = <>} ;
|
||||
|
||||
Integer : Type = {s : Str ; lock_Int : {}} ;
|
||||
Floating : Type = {s : Str ; lock_Float : {}} ;
|
||||
|
||||
}
|
||||
|
||||
5
next-lib/src/api/SymbolicCat.gf
Normal file
5
next-lib/src/api/SymbolicCat.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:prelude
|
||||
|
||||
resource SymbolicCat = Symbolic with
|
||||
(Symbol = SymbolCat),
|
||||
(Syntax = SyntaxCat) ;
|
||||
5
next-lib/src/api/SymbolicDan.gf
Normal file
5
next-lib/src/api/SymbolicDan.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:mathematical:prelude
|
||||
|
||||
resource SymbolicDan = Symbolic with
|
||||
(Symbol = SymbolDan),
|
||||
(Grammar = GrammarDan) ;
|
||||
@@ -1,5 +1,5 @@
|
||||
--# -path=.:present:prelude
|
||||
--# -path=.:present:mathematical:prelude
|
||||
|
||||
resource SymbolicEng = Symbolic with
|
||||
(Symbol = SymbolEng),
|
||||
(Syntax = SyntaxEng) ;
|
||||
(Grammar = GrammarEng) ;
|
||||
|
||||
5
next-lib/src/api/SymbolicFin.gf
Normal file
5
next-lib/src/api/SymbolicFin.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:mathematical:prelude
|
||||
|
||||
resource SymbolicFin = Symbolic with
|
||||
(Symbol = SymbolFin),
|
||||
(Grammar = GrammarFin) ;
|
||||
5
next-lib/src/api/SymbolicFre.gf
Normal file
5
next-lib/src/api/SymbolicFre.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:mathematical:prelude
|
||||
|
||||
resource SymbolicFre = Symbolic with
|
||||
(Symbol = SymbolFre),
|
||||
(Grammar = GrammarFre) ;
|
||||
5
next-lib/src/api/SymbolicGer.gf
Normal file
5
next-lib/src/api/SymbolicGer.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:mathematical:prelude
|
||||
|
||||
resource SymbolicGer = Symbolic with
|
||||
(Symbol = SymbolGer),
|
||||
(Grammar = GrammarGer) ;
|
||||
5
next-lib/src/api/SymbolicIta.gf
Normal file
5
next-lib/src/api/SymbolicIta.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:mathematical:prelude
|
||||
|
||||
resource SymbolicIta = Symbolic with
|
||||
(Symbol = SymbolIta),
|
||||
(Grammar = GrammarIta) ;
|
||||
5
next-lib/src/api/SymbolicNor.gf
Normal file
5
next-lib/src/api/SymbolicNor.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:mathematical:prelude
|
||||
|
||||
resource SymbolicNor = Symbolic with
|
||||
(Symbol = SymbolNor),
|
||||
(Grammar = GrammarNor) ;
|
||||
5
next-lib/src/api/SymbolicSpa.gf
Normal file
5
next-lib/src/api/SymbolicSpa.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:mathematical:prelude
|
||||
|
||||
resource SymbolicSpa = Symbolic with
|
||||
(Symbol = SymbolSpa),
|
||||
(Grammar = GrammarSpa) ;
|
||||
5
next-lib/src/api/SymbolicSwe.gf
Normal file
5
next-lib/src/api/SymbolicSwe.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:mathematical:prelude
|
||||
|
||||
resource SymbolicSwe = Symbolic with
|
||||
(Symbol = SymbolSwe),
|
||||
(Grammar = GrammarSwe) ;
|
||||
@@ -21,4 +21,32 @@ concrete IdiomCat of Idiom = CatCat **
|
||||
)
|
||||
(predV (verbV (estar_54 "estar"))) ;
|
||||
|
||||
----AR, for completeness
|
||||
|
||||
CleftNP np rs = mkClause [] True (agrP3 Masc Sg)
|
||||
(insertComplement (\\_ => rs.s ! Indic ! np.a)
|
||||
(insertComplement (\\_ => np.s ! Ton rs.c) (predV copula))) ;
|
||||
|
||||
|
||||
ExistIP ip = {
|
||||
s = \\t,a,p,_ =>
|
||||
ip.s ! Nom ++
|
||||
(mkClause [] True
|
||||
(agrP3 Masc Sg)
|
||||
(insertClit2 "hi" (insertComplement (\\_ => ip.s ! Acc) (predV haver_V))))
|
||||
.s ! DDir ! t ! a ! p ! Indic
|
||||
} ;
|
||||
|
||||
ImpPl1 vpr = let vp = useVP vpr in {s =
|
||||
(mkImperative False P1 vp).s ! Pos ! {n = Pl ; g = Masc} --- fem
|
||||
} ;
|
||||
|
||||
CleftAdv ad s = mkClause [] True (agrP3 Masc Sg)
|
||||
(insertComplement (\\_ => conjThat ++ s.s ! Indic)
|
||||
(insertComplement (\\_ => ad.s) (predV copula))) ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
2
next-lib/src/catalan/SymbolCat.gf
Normal file
2
next-lib/src/catalan/SymbolCat.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete SymbolCat of Symbol = CatCat ** SymbolRomance with
|
||||
(ResRomance = ResCat) ;
|
||||
2
next-lib/src/danish/SymbolDan.gf
Normal file
2
next-lib/src/danish/SymbolDan.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete SymbolDan of Symbol = CatDan ** SymbolScand with
|
||||
(ResScand = ResDan) ;
|
||||
@@ -68,12 +68,10 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
|
||||
vai_Conj = {s1 = [] ; s2 = "vai" ; n = Sg} ;
|
||||
|
||||
|
||||
CompPartAP ap = {
|
||||
s = \\agr => ap.s ! False ! AN (NCase agr.n Part)
|
||||
s = \\agr => ap.s ! False ! NCase agr.n Part
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
42
next-lib/src/finnish/SymbolFin.gf
Normal file
42
next-lib/src/finnish/SymbolFin.gf
Normal file
@@ -0,0 +1,42 @@
|
||||
concrete SymbolFin of Symbol = CatFin ** open Prelude, NounFin, ResFin in {
|
||||
|
||||
lin
|
||||
SymbPN i = {s = \\c => i.s} ; --- c
|
||||
IntPN i = {s = \\c => i.s} ; --- c
|
||||
FloatPN i = {s = \\c => i.s} ; --- c
|
||||
NumPN i = {s = \\c => i.s!Sg!Nom } ; --- c
|
||||
|
||||
CNIntNP cn i = {
|
||||
s = \\c => cn.s ! NCase Sg (npform2case Sg c) ++ i.s ;
|
||||
a = agrP3 Sg ;
|
||||
isPron = False
|
||||
} ;
|
||||
CNSymbNP det cn xs = let detcn = NounFin.DetCN det cn in {
|
||||
s = \\c => detcn.s ! c ++ xs.s ;
|
||||
a = detcn.a ;
|
||||
isPron = False
|
||||
} ;
|
||||
CNNumNP cn i = {
|
||||
s = \\c => cn.s ! NCase Sg (npform2case Sg c) ++ i.s ! Sg ! Nom ;
|
||||
a = agrP3 Sg ;
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
SymbS sy = sy ;
|
||||
|
||||
SymbNum n = {s = \\_,_ => n.s ; isNum = True ; n = Pl} ;
|
||||
SymbOrd n = {s = \\_,_ => n.s ++ "."} ;
|
||||
|
||||
lincat
|
||||
|
||||
Symb, [Symb] = SS ;
|
||||
|
||||
lin
|
||||
|
||||
MkSymb s = s ;
|
||||
|
||||
BaseSymb = infixSS "ja" ;
|
||||
ConsSymb = infixSS "," ;
|
||||
|
||||
}
|
||||
|
||||
2
next-lib/src/french/SymbolFre.gf
Normal file
2
next-lib/src/french/SymbolFre.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete SymbolFre of Symbol = CatFre ** SymbolRomance with
|
||||
(ResRomance = ResFre) ;
|
||||
@@ -95,6 +95,8 @@ concrete CatGer of Cat =
|
||||
Tense = {s : Str ; t : ResGer.Tense ; m : Mood} ;
|
||||
|
||||
lin
|
||||
TTAnt t a = {s = t.s ++ a.s ; t = t.t ; a = a.a ; m = t.m} ;
|
||||
|
||||
TPres = {s = [] ; t = Pres ; m = MIndic} ;
|
||||
TPast = {s = [] ; t = Past ; m = MIndic} ; --# notpresent
|
||||
TFut = {s = [] ; t = Fut ; m = MIndic} ; --# notpresent
|
||||
|
||||
43
next-lib/src/german/SymbolGer.gf
Normal file
43
next-lib/src/german/SymbolGer.gf
Normal file
@@ -0,0 +1,43 @@
|
||||
concrete SymbolGer of Symbol = CatGer ** open Prelude, ResGer in {
|
||||
|
||||
lin
|
||||
SymbPN i = {s = \\c => i.s ; g = Neutr} ; --- c
|
||||
IntPN i = {s = \\c => i.s ; g = Neutr} ; --- c
|
||||
FloatPN i = {s = \\c => i.s ; g = Neutr} ; --- c
|
||||
NumPN i = {s = i.s ! Neutr ; g = Neutr} ; --- c
|
||||
|
||||
CNIntNP cn i = {
|
||||
s = \\c => cn.s ! Weak ! Sg ! Nom ++ i.s ;
|
||||
a = agrP3 Sg ;
|
||||
isPron = False
|
||||
} ;
|
||||
CNSymbNP det cn xs = let g = cn.g in {
|
||||
s = \\c => det.s ! g ! c ++ cn.s ! adjfCase det.a c ! det.n ! c ++ xs.s ;
|
||||
a = agrP3 det.n ;
|
||||
isPron = False
|
||||
} ;
|
||||
CNNumNP cn i = {
|
||||
s = \\c => artDef ! (GSg cn.g) ! c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ;
|
||||
a = agrP3 Sg ;
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
SymbS sy = {s = \\_ => sy.s} ;
|
||||
|
||||
SymbNum n = {s = \\_,_ => n.s ; n = Pl ; isNum = True} ;
|
||||
SymbOrd n = {s = \\_ => n.s ++ "."} ;
|
||||
|
||||
|
||||
lincat
|
||||
|
||||
Symb, [Symb] = SS ;
|
||||
|
||||
lin
|
||||
|
||||
MkSymb s = s ;
|
||||
|
||||
BaseSymb = infixSS "und" ;
|
||||
ConsSymb = infixSS "," ;
|
||||
|
||||
}
|
||||
|
||||
2
next-lib/src/italian/SymbolIta.gf
Normal file
2
next-lib/src/italian/SymbolIta.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete SymbolIta of Symbol = CatIta ** SymbolRomance with
|
||||
(ResRomance = ResIta) ;
|
||||
2
next-lib/src/norwegian/SymbolNor.gf
Normal file
2
next-lib/src/norwegian/SymbolNor.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete SymbolNor of Symbol = CatNor ** SymbolScand with
|
||||
(ResScand = ResNor) ;
|
||||
41
next-lib/src/romance/SymbolRomance.gf
Normal file
41
next-lib/src/romance/SymbolRomance.gf
Normal file
@@ -0,0 +1,41 @@
|
||||
incomplete concrete SymbolRomance of Symbol =
|
||||
CatRomance ** open Prelude, CommonRomance, ResRomance in {
|
||||
|
||||
lin
|
||||
SymbPN i = {s = i.s ; g = Masc} ;
|
||||
IntPN i = {s = i.s ; g = Masc} ;
|
||||
FloatPN i = {s = i.s ; g = Masc} ;
|
||||
NumPN i = {s = i.s!Masc ; g = Masc} ;
|
||||
|
||||
CNIntNP cn i = {
|
||||
s = \\c => cn.s ! Sg ++ i.s ;
|
||||
a = agrP3 cn.g Sg ;
|
||||
hasClit = False
|
||||
} ;
|
||||
CNSymbNP det cn xs = let g = cn.g in {
|
||||
s = \\c => det.s ! g ! npform2case c ++ cn.s ! det.n ++ xs.s ;
|
||||
a = agrP3 g det.n ;
|
||||
hasClit = False
|
||||
} ;
|
||||
CNNumNP cn i = {
|
||||
s = \\c => artDef cn.g Sg (npform2case c) ++ cn.s ! Sg ++ i.s ! Masc ;
|
||||
a = agrP3 cn.g Sg ;
|
||||
hasClit = False
|
||||
} ;
|
||||
SymbS sy = {s = \\_ => sy.s} ;
|
||||
|
||||
SymbNum n = {s = \\_ => n.s ; isNum = True ; n = Pl} ;
|
||||
SymbOrd n = {s = \\_ => n.s ++ "."} ; ---
|
||||
|
||||
lincat
|
||||
|
||||
Symb, [Symb] = SS ;
|
||||
|
||||
lin
|
||||
|
||||
MkSymb s = s ;
|
||||
|
||||
BaseSymb = infixSS "et" ; ----
|
||||
ConsSymb = infixSS "," ;
|
||||
|
||||
}
|
||||
38
next-lib/src/scandinavian/SymbolScand.gf
Normal file
38
next-lib/src/scandinavian/SymbolScand.gf
Normal file
@@ -0,0 +1,38 @@
|
||||
incomplete concrete SymbolScand of Symbol =
|
||||
CatScand ** open Prelude, ResScand, CommonScand in {
|
||||
|
||||
lin
|
||||
SymbPN i = {s = \\c => i.s ; g = Neutr} ; --- c
|
||||
IntPN i = {s = \\c => i.s ; g = Neutr} ; --- c
|
||||
FloatPN i = {s = \\c => i.s ; g = Neutr} ; --- c
|
||||
NumPN i = {s = \\c => i.s!neutrum ; g = Neutr} ; --- c
|
||||
CNIntNP cn i = {
|
||||
s = \\c => (cn.s ! Sg ! DIndef ! Nom ++ i.s) ;
|
||||
a = agrP3 cn.g Sg
|
||||
} ;
|
||||
CNSymbNP det cn xs = let g = cn.g in {
|
||||
s = \\c => det.s ! cn.isMod ! g ++ cn.s ! det.n ! det.det ! caseNP c ++ xs.s ;
|
||||
a = agrP3 g det.n
|
||||
} ;
|
||||
CNNumNP cn i = {
|
||||
s = \\c => (cn.s ! Sg ! DIndef ! Nom ++ i.s ! neutrum) ;
|
||||
a = agrP3 cn.g Sg
|
||||
} ;
|
||||
|
||||
SymbS sy = {s = \\_ => sy.s} ;
|
||||
|
||||
SymbNum n = {s = \\_ => n.s ; isDet = True ; n = Pl} ;
|
||||
SymbOrd n = {s = n.s ++ ":te" ; isDet = True} ; ---
|
||||
|
||||
lincat
|
||||
|
||||
Symb, [Symb] = SS ;
|
||||
|
||||
lin
|
||||
|
||||
MkSymb s = s ;
|
||||
|
||||
BaseSymb = infixSS conjAnd ;
|
||||
ConsSymb = infixSS "," ;
|
||||
|
||||
}
|
||||
2
next-lib/src/spanish/SymbolSpa.gf
Normal file
2
next-lib/src/spanish/SymbolSpa.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete SymbolSpa of Symbol = CatSpa ** SymbolRomance with
|
||||
(ResRomance = ResSpa) ;
|
||||
2
next-lib/src/swedish/SymbolSwe.gf
Normal file
2
next-lib/src/swedish/SymbolSwe.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete SymbolSwe of Symbol = CatSwe ** SymbolScand with
|
||||
(ResScand = ResSwe) ;
|
||||
@@ -11,8 +11,10 @@ import GF.Compile.AbsCompute
|
||||
-- for conversions
|
||||
import PGF.Data
|
||||
--import GF.Compile.GrammarToGFCC (mkType,mkExp)
|
||||
import GF.Grammar.Grammar
|
||||
import qualified GF.Grammar.Grammar as G
|
||||
import qualified GF.Grammar.Macros as M
|
||||
|
||||
import Data.List
|
||||
|
||||
type TreeOp = [Tree] -> [Tree]
|
||||
|
||||
@@ -24,7 +26,7 @@ allTreeOps = [
|
||||
("compute",("compute by using semantic definitions (def)",
|
||||
id)),
|
||||
("smallest",("sort trees from smallest to largest, in number of nodes",
|
||||
id)),
|
||||
smallest)),
|
||||
("typecheck",("type check and solve metavariables; reject if incorrect",
|
||||
id))
|
||||
]
|
||||
@@ -35,7 +37,24 @@ typeCheck pgf t = (t,(True,[]))
|
||||
compute :: PGF -> Tree -> Tree
|
||||
compute pgf t = t
|
||||
|
||||
smallest :: [Tree] -> [Tree]
|
||||
smallest = sortBy (\t u -> compare (size t) (size u)) where
|
||||
size t = case t of
|
||||
Abs _ b -> size b + 1
|
||||
Fun f ts -> sum (map size ts) + 1
|
||||
_ -> 1
|
||||
|
||||
{-
|
||||
toTree :: G.Term -> Tree
|
||||
toTree t = case M.termForm t of
|
||||
Ok (xx,f,aa) -> Abs xx (Fun f (map toTree aa))
|
||||
|
||||
fromTree :: Tree -> G.Term
|
||||
fromTree t = case t of
|
||||
Abs xx b -> M.mkAbs xx (fromTree b)
|
||||
Var x -> M.vr x
|
||||
Fun f ts -> M.mkApp f (map fromTree ts)
|
||||
-}
|
||||
|
||||
{-
|
||||
data Tree =
|
||||
|
||||
@@ -34,6 +34,10 @@ lookType :: PGF -> CId -> Type
|
||||
lookType pgf f =
|
||||
fst $ lookMap (error $ "lookType " ++ show f) f (funs (abstract pgf))
|
||||
|
||||
lookDef :: PGF -> CId -> Expr
|
||||
lookDef pgf f =
|
||||
snd $ lookMap (error $ "lookDef " ++ show f) f (funs (abstract pgf))
|
||||
|
||||
lookValCat :: PGF -> CId -> CId
|
||||
lookValCat pgf = valCat . lookType pgf
|
||||
|
||||
@@ -137,4 +141,4 @@ combinations t = case t of
|
||||
aa:uu -> [a:u | a <- aa, u <- combinations uu]
|
||||
|
||||
isLiteralCat :: CId -> Bool
|
||||
isLiteralCat = (`elem` [mkCId "String", mkCId "Float", mkCId "Int"])
|
||||
isLiteralCat = (`elem` [mkCId "String", mkCId "Float", mkCId "Int"])
|
||||
|
||||
Reference in New Issue
Block a user