took tense linearizations apart from Common/Cat to Tense, for bettter structure of lib

This commit is contained in:
aarne
2009-12-03 10:53:14 +00:00
parent 5c678ab686
commit a7809c3e1c
35 changed files with 127 additions and 96 deletions

View File

@@ -3,14 +3,6 @@
-- This module defines the categories that uniformly have the linearization -- This module defines the categories that uniformly have the linearization
-- ${s : Str}$ in all languages. -- ${s : Str}$ in all languages.
-- Moreover, this module defines the abstract parameters of tense, polarity, and
-- anteriority, which are used in [``Phrase`` Phrase.html] to generate different
-- forms of sentences. Together they give 4 x 2 x 2 = 16 sentence forms.
-- These tenses are defined for all languages in the library. More tenses
-- can be defined in the language extensions, e.g. the "passé simple" of
-- Romance languages in [``ExtraRomance`` ../romance/ExtraRomance.gf].
abstract Common = { abstract Common = {
cat cat
@@ -51,14 +43,4 @@ abstract Common = {
Pol ; -- polarity e.g. positive, negative Pol ; -- polarity e.g. positive, negative
Ant ; -- anteriority e.g. simultaneous, anterior Ant ; -- anteriority e.g. simultaneous, anterior
fun
TTAnt : Tense -> Ant -> Temp ;
PPos, PNeg : Pol ; -- I sleep/don't sleep
TPres : Tense ;
ASimul : Ant ;
TPast, TFut, TCond : Tense ; -- I slept/will sleep/would sleep --# notpresent
AAnter : Ant ; -- I have slept --# notpresent
} }

View File

@@ -18,6 +18,6 @@ abstract Grammar =
Phrase, Phrase,
Text, Text,
Structural, Structural,
Idiom ; Idiom,
Tense ;

22
lib/src/abstract/Tense.gf Normal file
View File

@@ -0,0 +1,22 @@
--1 Common: Structures with Common Implementations.
-- This module defines the abstract parameters of tense, polarity, and
-- anteriority, which are used in [``Phrase`` Phrase.html] to generate different
-- forms of sentences. Together they give 4 x 2 x 2 = 16 sentence forms.
-- These tenses are defined for all languages in the library. More tenses
-- can be defined in the language extensions, e.g. the "passé simple" of
-- Romance languages in [``ExtraRomance`` ../romance/ExtraRomance.gf].
abstract Tense = Common ** {
fun
TTAnt : Tense -> Ant -> Temp ;
PPos, PNeg : Pol ; -- I sleep/don't sleep
TPres : Tense ;
ASimul : Ant ;
TPast, TFut, TCond : Tense ; -- I slept/will sleep/would sleep --# notpresent
AAnter : Ant ; -- I have slept --# notpresent
}

View File

@@ -13,7 +13,8 @@ concrete GrammarAra of Grammar =
PhraseAra, PhraseAra,
TextX - [Utt], TextX - [Utt],
StructuralAra, StructuralAra,
IdiomAra IdiomAra,
TenseX - [Utt]
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -13,7 +13,8 @@ concrete GrammarBul of Grammar =
PhraseBul, PhraseBul,
TextBul, TextBul,
StructuralBul, StructuralBul,
IdiomBul IdiomBul,
TenseX - [CAdv,IAdv]
** { ** {
flags coding=cp1251 ; flags coding=cp1251 ;

View File

@@ -11,9 +11,10 @@ concrete GrammarCat of Grammar =
RelativeCat, RelativeCat,
ConjunctionCat, ConjunctionCat,
PhraseCat, PhraseCat,
TextX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond], TextX - [Temp,Tense],
IdiomCat, IdiomCat,
StructuralCat StructuralCat,
TenseCat
** { ** {

View File

@@ -0,0 +1,3 @@
concrete TenseCat of Tense = CatCat, TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
TenseRomance with
(ResRomance = ResCat) ;

View File

@@ -19,16 +19,4 @@ concrete CommonX of Common = open (R = ParamX) in {
Ant = {s : Str ; a : R.Anteriority} ; Ant = {s : Str ; a : R.Anteriority} ;
Pol = {s : Str ; p : R.Polarity} ; Pol = {s : Str ; p : R.Polarity} ;
lin
TTAnt t a = {s = t.s ++ a.s ; t = t.t ; a = a.a} ;
PPos = {s = []} ** {p = R.Pos} ;
PNeg = {s = []} ** {p = R.Neg} ;
TPres = {s = []} ** {t = R.Pres} ;
TPast = {s = []} ** {t = R.Past} ; --# notpresent
TFut = {s = []} ** {t = R.Fut} ; --# notpresent
TCond = {s = []} ** {t = R.Cond} ; --# notpresent
ASimul = {s = []} ** {a = R.Simul} ;
AAnter = {s = []} ** {a = R.Anter} ; --# notpresent
} }

View File

@@ -1,18 +1,14 @@
concrete TenseX of Tense = open (R = ParamX) in { concrete TenseX of Tense = CommonX ** open (R = ParamX) in {
lincat
Tense = {s : Str ; t : R.Tense} ;
Ant = {s : Str ; a : R.Anteriority} ;
Pol = {s : Str ; p : R.Polarity} ;
lin lin
TTAnt t a = {s = t.s ++ a.s ; t = t.t ; a = a.a} ;
PPos = {s = []} ** {p = R.Pos} ; PPos = {s = []} ** {p = R.Pos} ;
PNeg = {s = []} ** {p = R.Neg} ; PNeg = {s = []} ** {p = R.Neg} ;
TPres = {s = []} ** {t = R.Pres} ; TPres = {s = []} ** {t = R.Pres} ;
TPast = {s = []} ** {t = R.Past} ; TPast = {s = []} ** {t = R.Past} ; --# notpresent
TFut = {s = []} ** {t = R.Fut} ; TFut = {s = []} ** {t = R.Fut} ; --# notpresent
TCond = {s = []} ** {t = R.Cond} ; TCond = {s = []} ** {t = R.Cond} ; --# notpresent
ASimul = {s = []} ** {a = R.Simul} ; ASimul = {s = []} ** {a = R.Simul} ;
AAnter = {s = []} ** {a = R.Anter} ; AAnter = {s = []} ** {a = R.Anter} ; --# notpresent
} }

View File

@@ -13,7 +13,8 @@ concrete GrammarDan of Grammar =
PhraseDan, PhraseDan,
TextX, TextX,
IdiomDan, IdiomDan,
StructuralDan StructuralDan,
TenseX
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -13,4 +13,5 @@ concrete GrammarDut of Grammar =
PhraseDut, PhraseDut,
TextX, TextX,
IdiomDut, IdiomDut,
StructuralDut ; StructuralDut,
TenseX ;

View File

@@ -13,7 +13,8 @@ concrete GrammarEng of Grammar =
PhraseEng, PhraseEng,
TextX, TextX,
StructuralEng, StructuralEng,
IdiomEng IdiomEng,
TenseX
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -13,7 +13,8 @@ concrete GrammarFin of Grammar =
PhraseFin, PhraseFin,
TextX, TextX,
IdiomFin, IdiomFin,
StructuralFin StructuralFin,
TenseX
** { ** {
flags startcat = Phr ; unlexer = finnish ; lexer = text ; flags startcat = Phr ; unlexer = finnish ; lexer = text ;

View File

@@ -11,9 +11,10 @@ concrete GrammarFre of Grammar =
RelativeFre, RelativeFre,
ConjunctionFre, ConjunctionFre,
PhraseFre, PhraseFre,
TextX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond], TextX - [Temp,Tense],
IdiomFre, IdiomFre,
StructuralFre StructuralFre,
TenseFre
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -0,0 +1,3 @@
concrete TenseFre of Tense = CatFre, TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
TenseRomance with
(ResRomance = ResFre) ;

View File

@@ -1,5 +1,5 @@
concrete CatGer of Cat = concrete CatGer of Cat =
CommonX - [Tense,TPres,TPast,TFut,TCond,TTAnt,Temp] ** CommonX - [Tense,Temp] **
open ResGer, Prelude in { open ResGer, Prelude in {
flags optimize=all_subs ; flags optimize=all_subs ;
@@ -93,11 +93,4 @@ concrete CatGer of Cat =
Temp = {s : Str ; t : ResGer.Tense ; a : Anteriority ; m : Mood} ; Temp = {s : Str ; t : ResGer.Tense ; a : Anteriority ; m : Mood} ;
Tense = {s : Str ; t : ResGer.Tense ; m : Mood} ; 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
TCond = {s = [] ; t = Cond ; m = MIndic} ; --# notpresent
} }

View File

@@ -11,9 +11,10 @@ concrete GrammarGer of Grammar =
RelativeGer, RelativeGer,
ConjunctionGer, ConjunctionGer,
PhraseGer, PhraseGer,
TextX - [Tense,TPres,TPast,TFut,TCond,TTAnt,Temp], TextX - [Tense,Temp],
IdiomGer, IdiomGer,
StructuralGer StructuralGer,
TenseGer
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -152,7 +152,7 @@ resource ResGer = ParamX ** open Prelude in {
} ; } ;
conjAgr : Agr -> Agr -> Agr = \a,b -> { conjAgr : Agr -> Agr -> Agr = \a,b -> {
g = Utr ; ---- g = Neutr ; ----
n = conjNumber a.n b.n ; n = conjNumber a.n b.n ;
p = conjPerson a.p b.p p = conjPerson a.p b.p
} ; } ;

View File

@@ -0,0 +1,12 @@
concrete TenseGer of Tense =
CatGer [Tense,Temp], TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] ** open ResGer in {
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
TCond = {s = [] ; t = Cond ; m = MIndic} ; --# notpresent
}

View File

@@ -13,7 +13,8 @@ concrete GrammarHin of Grammar =
PhraseHin, PhraseHin,
TextX, TextX,
StructuralHin, StructuralHin,
IdiomHin IdiomHin,
TenseX
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -11,9 +11,10 @@ concrete GrammarIta of Grammar =
RelativeIta, RelativeIta,
ConjunctionIta, ConjunctionIta,
PhraseIta, PhraseIta,
TextX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond], TextX - [Temp,Tense],
IdiomIta, IdiomIta,
StructuralIta StructuralIta,
TenseIta
** { ** {

View File

@@ -0,0 +1,3 @@
concrete TenseIta of Tense = CatIta, TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
TenseRomance with
(ResRomance = ResIta) ;

View File

@@ -12,7 +12,8 @@ concrete GrammarLat of Grammar =
-- ConjunctionLat, -- ConjunctionLat,
-- PhraseLat, -- PhraseLat,
TextX, TextX,
StructuralLat StructuralLat,
-- IdiomLat -- IdiomLat
TenseX
** { ** {
} ; } ;

View File

@@ -13,7 +13,8 @@ concrete GrammarNor of Grammar =
PhraseNor, PhraseNor,
TextX, TextX,
IdiomNor, IdiomNor,
StructuralNor StructuralNor,
TenseX
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -15,5 +15,6 @@ concrete GrammarPol of Grammar =
PhrasePol, PhrasePol,
TextX - [CAdv], TextX - [CAdv],
StructuralPol, StructuralPol,
IdiomPol IdiomPol,
TenseX - [CAdv]
** { flags startcat = Phr ; unlexer = text ; lexer = text ;} ; ** { flags startcat = Phr ; unlexer = text ; lexer = text ;} ;

View File

@@ -1,5 +1,4 @@
incomplete concrete CatRomance of Cat = incomplete concrete CatRomance of Cat = CommonX
CommonX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond]
** open Prelude, CommonRomance, ResRomance, (R = ParamX) in { ** open Prelude, CommonRomance, ResRomance, (R = ParamX) in {
flags optimize=all_subs ; flags optimize=all_subs ;
@@ -102,14 +101,8 @@ incomplete concrete CatRomance of Cat =
PN = {s : Str ; g : Gender} ; PN = {s : Str ; g : Gender} ;
-- tense augmented with passé simple -- tense augmented with passé simple
lincat
Temp = {s : Str ; t : RTense ; a : Anteriority} ; Temp = {s : Str ; t : RTense ; a : Anteriority} ;
Tense = {s : Str ; t : RTense} ; Tense = {s : Str ; t : RTense} ;
lin
TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ;
TPres = {s = []} ** {t = RPres} ;
TPast = {s = []} ** {t = RPast} ; --# notpresent
TFut = {s = []} ** {t = RFut} ; --# notpresent
TCond = {s = []} ** {t = RCond} ; --# notpresent
} }

View File

@@ -0,0 +1,12 @@
incomplete concrete TenseRomance of Tense =
CatRomance [Tense,Temp], TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
open ResRomance, CommonRomance in {
lin
TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ;
TPres = {s = []} ** {t = RPres} ;
TPast = {s = []} ** {t = RPast} ; --# notpresent
TFut = {s = []} ** {t = RFut} ; --# notpresent
TCond = {s = []} ** {t = RCond} ; --# notpresent
}

View File

@@ -1,7 +1,7 @@
--# -path=.:../Romance:../common:../abstract:../common:prelude --# -path=.:../Romance:../common:../abstract:../common:prelude
concrete CatRon of Cat = concrete CatRon of Cat =
CommonX - [CAdv,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond] CommonX - [CAdv,Temp,Tense]
** open Prelude, ResRon, MorphoRon,(R = ParamX) in { ** open Prelude, ResRon, MorphoRon,(R = ParamX) in {
flags optimize=all_subs ; flags optimize=all_subs ;
@@ -136,15 +136,6 @@ concrete CatRon of Cat =
Tense = {s : Str ; t : RTense} ; Tense = {s : Str ; t : RTense} ;
lin
TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ;
TPres = {s = []} ** {t = RPres} ;
TPast = {s = []} ** {t = RPast} ; --# notpresent
TFut = {s = []} ** {t = RFut} ; --# notpresent
TCond = {s = []} ** {t = RCond} ; --# notpresent
oper oper
aagr : Gender -> Number -> AAgr = \g,n -> aagr : Gender -> Number -> AAgr = \g,n ->

View File

@@ -12,9 +12,10 @@ concrete GrammarRon of Grammar =
RelativeRon, RelativeRon,
ConjunctionRon, ConjunctionRon,
PhraseRon, PhraseRon,
TextX - [CAdv,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond], TextX - [CAdv,Temp,Tense],
Prelude, MorphoRon, Coordination, Prelude, MorphoRon, Coordination,
StructuralRon StructuralRon,
TenseRon
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -0,0 +1,11 @@
concrete TenseRon of Tense =
CatRon [Tense,Temp], TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] ** open ResRon in {
lin
TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ;
TPres = {s = []} ** {t = RPres} ;
TPast = {s = []} ** {t = RPast} ; --# notpresent
TFut = {s = []} ** {t = RFut} ; --# notpresent
TCond = {s = []} ** {t = RCond} ; --# notpresent
}

View File

@@ -13,5 +13,6 @@ concrete GrammarRus of Grammar =
PhraseRus, PhraseRus,
TextX, TextX,
StructuralRus, StructuralRus,
IdiomRus IdiomRus,
TenseX
** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ;} ; ** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ;} ;

View File

@@ -11,9 +11,10 @@ concrete GrammarSpa of Grammar =
RelativeSpa, RelativeSpa,
ConjunctionSpa, ConjunctionSpa,
PhraseSpa, PhraseSpa,
TextSpa - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond], -- special punctuation TextSpa - [Temp,Tense], -- special punctuation
IdiomSpa, IdiomSpa,
StructuralSpa StructuralSpa,
TenseSpa
** { ** {

View File

@@ -0,0 +1,3 @@
concrete TenseSpa of Tense = CatSpa, TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
TenseRomance with
(ResRomance = ResSpa) ;

View File

@@ -13,7 +13,8 @@ concrete GrammarSwe of Grammar =
PhraseSwe, PhraseSwe,
TextX, TextX,
IdiomSwe, IdiomSwe,
StructuralSwe StructuralSwe,
TenseX
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -12,8 +12,9 @@ concrete GrammarTha of Grammar =
-- ConjunctionTha, -- ConjunctionTha,
PhraseTha, PhraseTha,
-- TextX, -- TextX,
StructuralTha StructuralTha,
-- IdiomTha -- IdiomTha
TenseX
** { ** {
flags startcat = Phr ; unlexer = text ; lexer = text ; flags startcat = Phr ; unlexer = text ; lexer = text ;