resource.txt updates ; lock field and lookup book fixes

This commit is contained in:
aarne
2006-06-20 15:05:22 +00:00
parent 0333ba894b
commit a6cc18c8bd
9 changed files with 238 additions and 179 deletions

Binary file not shown.

View File

@@ -15,6 +15,7 @@ Last update: %%date(%c)
%!postproc(tex): "#ECENTER" "end{center}" %!postproc(tex): "#ECENTER" "end{center}"
%!postproc(tex): "#CAPTION" "caption{" %!postproc(tex): "#CAPTION" "caption{"
%!postproc(tex): "#RBRACE" "end{figure}" %!postproc(tex): "#RBRACE" "end{figure}"
%!postproc(tex): "#CLEARPAGE" "clearpage"
%!target:tex %!target:tex
@@ -95,7 +96,8 @@ variation is taken care of by the resource grammar function
``` ```
fun AdjCN : AP -> CN -> CN fun AdjCN : AP -> CN -> CN
``` ```
The resource grammar implementation of the rule adding properties (see the tables in the end of this document for the list of all resource grammar
functions). The resource grammar implementation of the rule adding properties
to kinds is to kinds is
``` ```
lin PropKind kind prop = AdjCN prop kind lin PropKind kind prop = AdjCN prop kind
@@ -248,6 +250,46 @@ gives its own definition of this function:
} }
``` ```
==Lock fields==
When the categories of the resource grammar are used
in applications, a **lock field** is added to their linearization types.
The lock field makes the linearization type of each category
unique, so that categories
with the same implementation are not confused with each other.
(This is inspired by the ``newtype`` discipline in Haskell.)
For instance, the lincats of adverbs and conjunctions are the same
in ``CatEng`` (and therefore in ``GrammarEng``, which inherits it):
```
lincat Adv = {s : Str} ;
lincat Conj = {s : Str} ;
```
But when these category symbols are used to denote their linearization
types in an application, these definitions are translated to
```
oper Adv : Type = {s : Str ; lock_Adv : {}} ;
oper Conj : Type = {s : Str} ; lock_Conj : {}} ;
```
In this way, the user of a resource grammar cannot confuse adverbs with
conjunctions. In other words, the lock fields force the type checker
to function as grammaticality checker.
When the resource grammar is ``open``ed in an application grammar,
and only functions from the resource are used in type-correct way, the
lock fields are never seen (except possibly in type error messages).
If an application grammarian has to write lock fields herself,
it is a sign that the guarantees given by the resource grammar
no longer hold. But since the resource may be incomplete, the
application grammarian may occasionally have to provide the dummy
values of lock fields (always ``<>``, the empty record).
Here is an example:
```
mkUtt : Str -> Utt ;
mkUtt s = {s = s ; lock_Utt = <>} ;
```
Currently, missing lock field produce warnings rather than errors,
but this behaviour of GF may change in future.
==Parsing with resource grammars?== ==Parsing with resource grammars?==
@@ -906,60 +948,67 @@ has only been exploited in a very small scale so far.
%!include: ../lib/resource-1.0/swedish/ParadigmsSwe.txt %!include: ../lib/resource-1.0/swedish/ParadigmsSwe.txt
#CLEARPAGE
#SMALL
=Summary of Categories and Functions= =Summary of Categories and Functions=
These tables show all categories and functions in ``Grammar``,
except the functions in ``Structural``.
All example strings can be parsed in ``LangEng``.
==Categories== ==Categories==
#SMALL
|| Category | Module | Explanation | Example | || Category | Module | Explanation | Example |
| A2 | Cat | two place adjective | "divisible" | A2 | Cat | two place adjective | "married"
| A | Cat | one place adjective | "warm" | A | Cat | one place adjective | "old"
| AdA | Common | adjective modifying adverb, | "very" | AdA | Common | adjective modifying adverb, | "very"
| AdN | Common | numeral modifying adverb, | "more than" | AdN | Common | numeral modifying adverb, | "more than"
| AdV | Common | adverb directly attached to verb | "always" | AdV | Common | adverb directly attached to verb | "always"
| Adv | Common | verb phrase modifying adverb, | "in the house" | Adv | Common | verb phrase modifying adverb, | "in the house"
| Ant | Common | anteriority | simultaneous | Ant | Common | anteriority | simultaneous
| AP | Cat | adjectival phrase | "very warm" | AP | Cat | adjectival phrase | "very old"
| CAdv | Common | comparative adverb | "more" | CAdv | Common | comparative adverb | "more"
| Cl | Cat | declarative clause, with all tenses | "she looks at this" | Cl | Cat | declarative clause, with all tenses | "she walks"
| CN | Cat | common noun (without determiner) | "red house" | CN | Cat | common noun (without determiner) | "red house"
| Comp | Cat | complement of copula, such as AP | "very warm" | Comp | Cat | complement of copula, such as AP | "very warm"
| Conj | Cat | conjunction, | "and" | Conj | Cat | conjunction, | "and"
| DConj | Cat | distributed conj. | "both and" | DConj | Cat | distributed conj. | "both" - "and"
| Det | Cat | determiner phrase | "all the seven" | Det | Cat | determiner phrase | "these seven"
| Digit | Numeral | digit from 2 to 9 | "4" | Digit | Numeral | digit from 2 to 9 | "4"
| IAdv | Common | interrogative adverb | "why" | IAdv | Common | interrogative adverb | "why"
| IComp | Cat | interrogative complement of copula | "where" | IComp | Cat | interrogative complement of copula | "where"
| IDet | Cat | interrogative determiner | "which" | IDet | Cat | interrogative determiner | "which"
| Imp | Cat | imperative | "look at this" | Imp | Cat | imperative | "look at this"
| IP | Cat | interrogative pronoun | "who" | IP | Cat | interrogative pronoun | "who"
| N2 | Cat | relational noun | "son" | N2 | Cat | relational noun | "brother"
| N3 | Cat | three place relational noun | "connection" | N3 | Cat | three place relational noun | "connection"
| N | Cat | common noun | "house" | N | Cat | common noun | "house"
| NP | Cat | noun phrase (subject or object) | "the red house" | NP | Cat | noun phrase (subject or object) | "the red house"
| Num | Cat | cardinal number (used with QuantPl) | "seven" | Num | Cat | cardinal number (used with QuantPl) | "seven"
| Numeral | Cat | cardinal or ordinal, | "five/fifth" | Numeral | Cat | cardinal or ordinal, | "five" / "fifth"
| Ord | Cat | ordinal number (used in Det) | "seventh" | Ord | Cat | ordinal number (used in Det) | "seventh"
| PConj | Common | phrase beginning conj. | "therefore" | PConj | Common | phrase beginning conj. | "therefore"
| Phr | Common | phrase in a text | "but be quiet please" | Phr | Common | phrase in a text | "but look at this please"
| PN | Cat | proper name | "Paris" | PN | Cat | proper name | "Paris"
| Pol | Common | polarity | positive | Pol | Common | polarity | positive
| Predet | Cat | predeterminer (prefixed Quant) | "all" | Predet | Cat | predeterminer (prefixed Quant) | "all"
| Prep | Cat | preposition, or just case | "in" | Prep | Cat | preposition, or just case | "in"
| Pron | Cat | personal pronoun | "she" | Pron | Cat | personal pronoun | "she"
| QCl | Cat | question clause, with all tenses | "why does she walk" | QCl | Cat | question clause, with all tenses | "why does she walk"
| QS | Cat | question | "where did she live" | QS | Cat | question | "where did she walk"
| Quant | Cat | quantifier with both sg and pl | "this/these" | Quant | Cat | quantifier with both sg and pl | "this"/"these"
| QuantPl | Cat | quantifier ('nucleus' of plur. Det) | "many" | QuantPl | Cat | quantifier ('nucleus' of plur. Det) | "many"
| QuantSg | Cat | quantifier ('nucleus' of sing. Det) | "every" | QuantSg | Cat | quantifier ('nucleus' of sing. Det) | "every"
| RCl | Cat | relative clause, with all tenses | "in which she lives" | RCl | Cat | relative clause, with all tenses | "in which she walks"
| RP | Cat | relative pronoun | "in which" | RP | Cat | relative pronoun | "in which"
| RS | Cat | relative | "in which she lived" | RS | Cat | relative | "that she loves"
| S | Cat | declarative sentence | "she lived here" | S | Cat | declarative sentence | "she was here"
| SC | Common | embedded sentence or question | "that it rains" | SC | Common | embedded sentence or question | "that it rains"
| Slash | Cat | clause missing NP (S/NP in GPSG) | "she looks at" | Slash | Cat | clause missing NP (S/NP in GPSG) | "she loves"
|| Category | Module | Explanation | Example | || Category | Module | Explanation | Example |
@@ -992,174 +1041,174 @@ has only been exploited in a very small scale so far.
|| Function | Module | Type | Example | || Function | Module | Type | Example |
| AAnter | Common | Ant | "" | AAnter | Common | Ant | ""
| ASimul | Common | Ant | "" | ASimul | Common | Ant | ""
| AdAdv | Adverb | AdA -> Adv -> Adv | very quickly | AdAdv | Adverb | AdA -> Adv -> Adv | "very"
| AdAP | Adjective | AdA -> AP -> AP | very uncertain | AdAP | Adjective | AdA -> AP -> AP | "very old"
| AdjCN | Noun | AP -> CN -> CN | big house | AdjCN | Noun | AP -> CN -> CN | "big house"
| AdnCAdv | Adverb | CAdv -> AdN | more (than five) | AdnCAdv | Adverb | CAdv -> AdN | "more than"
| AdNum | Noun | AdN -> Num -> Num | almost 51 | AdNum | Noun | AdN -> Num -> Num | "almost ten"
| AdvCN | Noun | CN -> Adv -> CN | house on the hill | AdvCN | Noun | CN -> Adv -> CN | "house on the mountain"
| AdvIP | Question | IP -> Adv -> IP | who in Europe | AdvIP | Question | IP -> Adv -> IP | "who in Paris"
| AdvNP | Noun | NP -> Adv -> NP | Paris at midnight | AdvNP | Noun | NP -> Adv -> NP | "Paris without wine"
| AdvSC | Adverb | SC -> Adv | that he arrives | AdvSC | Adverb | SC -> Adv | "that he sleeps"
| AdvSlash | Sentence | Slash -> Adv -> Slash | (whom) he sees tomorrow | AdvSlash | Sentence | Slash -> Adv -> Slash | "she sees here"
| AdVVP | Verb | AdV -> VP -> VP | always sleep | AdVVP | Verb | AdV -> VP -> VP | "always sleep"
| AdvVP | Verb | VP -> Adv -> VP | sleep here | AdvVP | Verb | VP -> Adv -> VP | "sleep here"
| ApposCN | Noun | CN -> NP -> CN | number x, numbers x and y | ApposCN | Noun | CN -> NP -> CN | "number x"
| BaseAdv | Conjunction | Adv -> Adv -> [Adv] | "here, today" | BaseAdv | Conjunction | Adv -> Adv -> [Adv] | "here" - "today"
| BaseAP | Conjunction | AP -> AP -> [AP] | "even, odd" | BaseAP | Conjunction | AP -> AP -> [AP] | "even" - "odd"
| BaseNP | Conjunction | NP -> NP -> [NP] | "John, Mary" | BaseNP | Conjunction | NP -> NP -> [NP] | "the car" - "the house"
| BaseS | Conjunction | S -> S -> [S] | "I walk, you run" | BaseS | Conjunction | S -> S -> [S] | "I walk" - "you run"
| CleftAdv | Idiom | Adv -> S -> Cl | it is yesterday she arrived | CleftAdv | Idiom | Adv -> S -> Cl | "it is here that she sleeps"
| CleftNP | Idiom | NP -> RS -> Cl | it is you who did it | CleftNP | Idiom | NP -> RS -> Cl | "it is she who sleeps"
| CompAdv | Verb | Adv -> Comp | (be) here | CompAdv | Verb | Adv -> Comp | "here"
| CompAP | Verb | AP -> Comp | (be) small | CompAP | Verb | AP -> Comp | "old"
| ComparA | Adjective | A -> NP -> AP | warmer than Spain | ComparA | Adjective | A -> NP -> AP | "warmer than the house"
| ComparAdvAdj | Adverb | CAdv -> A -> NP -> Adv | more quickly than John | ComparAdvAdj | Adverb | CAdv -> A -> NP -> Adv | "more heavily than Paris"
| ComparAdvAdjS | Adverb | CAdv -> A -> S -> Adv | more quickly than he runs | ComparAdvAdjS | Adverb | CAdv -> A -> S -> Adv | "more heavily than she sleeps"
|| Function | Module | Type | Example | || Function | Module | Type | Example |
| CompIAdv | Question | IAdv -> IComp | where | CompIAdv | Question | IAdv -> IComp | "where"
| ComplA2 | Adjective | A2 -> NP -> AP | divisible by 2 | ComplA2 | Adjective | A2 -> NP -> AP | "married to her"
| ComplN2 | Noun | N2 -> NP -> CN | son of the king | ComplN2 | Noun | N2 -> NP -> CN | "brother of the woman"
| ComplN3 | Noun | N3 -> NP -> N2 | flight from Moscow (to Paris) | ComplN3 | Noun | N3 -> NP -> N2 | "connection from that city to Paris"
| ComplV2A | Verb | V2A -> NP -> AP -> VP | paint the house red | ComplV2A | Verb | V2A -> NP -> AP -> VP | "paint the house red"
| ComplV2 | Verb | V2 -> NP -> VP | use it | ComplV2 | Verb | V2 -> NP -> VP | "love it"
| ComplV3 | Verb | V3 -> NP -> NP -> VP | send a message to her | ComplV3 | Verb | V3 -> NP -> NP -> VP | "send flowers to us"
| ComplVA | Verb | VA -> AP -> VP | look red | ComplVA | Verb | VA -> AP -> VP | "become red"
| ComplVQ | Verb | VQ -> QS -> VP | ask if she runs | ComplVQ | Verb | VQ -> QS -> VP | "ask if she runs"
| ComplVS | Verb | VS -> S -> VP | know that she runs | ComplVS | Verb | VS -> S -> VP | "say that she runs"
| ComplVV | Verb | VV -> VP -> VP | want to run | ComplVV | Verb | VV -> VP -> VP | "want to run"
| CompNP | Verb | NP -> Comp | (be) a soldier | CompNP | Verb | NP -> Comp | "a man"
| ConjAdv | Conjunction | Conj -> [Adv] -> Adv | quickly or slowly | ConjAdv | Conjunction | Conj -> [Adv] -> Adv | "here or in the car"
| ConjAP | Conjunction | Conj -> [AP] -> AP | even and prime | ConjAP | Conjunction | Conj -> [AP] -> AP | "warm or cold"
| ConjNP | Conjunction | Conj -> [NP] -> NP | John or Mary | ConjNP | Conjunction | Conj -> [NP] -> NP | "the man or the woman"
| ConjS | Conjunction | Conj -> [S] -> S | John walks and Mary runs | ConjS | Conjunction | Conj -> [S] -> S | "he walks or she runs"
| ConsAdv | Conjunction | Adv -> [Adv] -> [Adv] | "here, today, with us" | ConsAdv | Conjunction | Adv -> [Adv] -> [Adv] | "here" - "without them, with us"
| ConsAP | Conjunction | AP -> [AP] -> [AP] | "even, odd, prime" | ConsAP | Conjunction | AP -> [AP] -> [AP] | "warm" - "red, old"
| ConsNP | Conjunction | NP -> [NP] -> [NP] | "John, Mary, you" | ConsNP | Conjunction | NP -> [NP] -> [NP] | "she" - "you, I"
| ConsS | Conjunction | S -> [S] -> [S] | "I walk, you run, he sleeps" | ConsS | Conjunction | S -> [S] -> [S] | "I walk" - "she runs, he sleeps"
| DConjAdv | Conjunction | DConj -> [Adv] -> Adv | both badly and slowly | DConjAdv | Conjunction | DConj -> [Adv] -> Adv | "either here or there"
| DConjAP | Conjunction | DConj -> [AP] -> AP | both even and prime | DConjAP | Conjunction | DConj -> [AP] -> AP | "either warm or cold"
| DConjNP | Conjunction | DConj -> [NP] -> NP | either John or Mary | DConjNP | Conjunction | DConj -> [NP] -> NP | "either the man or the woman"
| DConjS | Conjunction | DConj -> [S] -> S | either John walks or Mary runs | DConjS | Conjunction | DConj -> [S] -> S | "either he walks or she runs"
| DefArt | Noun | Quant | the (house), the (houses) | DefArt | Noun | Quant | "the"
| DetCN | Noun | Det -> CN -> NP | the man | DetCN | Noun | Det -> CN -> NP | "the man"
| DetPl | Noun | QuantPl -> Num -> Ord -> Det | these five best men | DetPl | Noun | QuantPl -> Num -> Ord -> Det | "the five best"
| DetSg | Noun | QuantSg -> Ord -> Det | this best man | DetSg | Noun | QuantSg -> Ord -> Det | "this"
| EmbedQS | Sentence | QS -> SC | whether you go | EmbedQS | Sentence | QS -> SC | "whom she loves"
| EmbedS | Sentence | S -> SC | that you go | EmbedS | Sentence | S -> SC | "that you go"
| EmbedVP | Sentence | VP -> SC | to go | EmbedVP | Sentence | VP -> SC | "to love it"
| ExistIP | Idiom | IP -> QCl | which houses are there | ExistIP | Idiom | IP -> QCl | "which cars are there"
| ExistNP | Idiom | NP -> Cl | there is a house | ExistNP | Idiom | NP -> Cl | "there is a car"
| FunRP | Relative | Prep -> NP -> RP -> RP | all the roots of which | FunRP | Relative | Prep -> NP -> RP -> RP | "all houses in which"
| GenericCl | Idiom | VP -> Cl | one sleeps | GenericCl | Idiom | VP -> Cl | "one sleeps"
| IDetCN | Question | IDet -> Num -> Ord -> CN -> IP | which five best songs | IDetCN | Question | IDet -> Num -> Ord -> CN -> IP | "which five hottest songs"
| IdRP | Relative | RP | which | IdRP | Relative | RP | "which"
| ImpersCl | Idiom | VP -> Cl | it rains | ImpersCl | Idiom | VP -> Cl | "it rains"
| ImpPl1 | Idiom | VP -> Utt | let's go | ImpPl1 | Idiom | VP -> Utt | "let's go"
| ImpVP | Sentence | VP -> Imp | go | ImpVP | Sentence | VP -> Imp | "go to the house"
| IndefArt | Noun | Quant | a (house), (houses) | IndefArt | Noun | Quant | "a"
| MassDet | Noun | QuantSg | (beer) | MassDet | Noun | QuantSg | ("beer")
| NoNum | Noun | Num | "" | NoNum | Noun | Num | ""
| NoOrd | Noun | Ord | "" | NoOrd | Noun | Ord | ""
| NoPConj | Phrase | PConj | "" | NoPConj | Phrase | PConj | ""
| NoVoc | Phrase | Voc | "" | NoVoc | Phrase | Voc | ""
| NumInt | Noun | Int -> Num | 51 | NumInt | Noun | Int -> Num | "51"
| NumNumeral | Noun | Numeral -> Num | fifty-one | NumNumeral | Noun | Numeral -> Num | "five hundred"
| OrdInt | Noun | Int -> Ord | 51st | OrdInt | Noun | Int -> Ord | "13 th"
| OrdNumeral | Noun | Numeral -> Ord | fifty-first | OrdNumeral | Noun | Numeral -> Ord | "thirteenth"
| OrdSuperl | Noun | A -> Ord | largest | OrdSuperl | Noun | A -> Ord | "hottest"
| PassV2 | Verb | V2 -> VP | be used | PassV2 | Verb | V2 -> VP | "be seen"
| PConjConj | Phrase | Conj -> PConj | and | PConjConj | Phrase | Conj -> PConj | "and"
| PhrUtt | Phrase | PConj -> Utt -> Voc -> Phr | But go home my friend. | PhrUtt | Phrase | PConj -> Utt -> Voc -> Phr | "but come here please"
| PlQuant | Noun | Quant -> QuantPl | these | PlQuant | Noun | Quant -> QuantPl | "these"
| PositA | Adjective | A -> AP | warm | PositA | Adjective | A -> AP | "warm"
| PositAdvAdj | Adverb | A -> Adv | quickly | PositAdvAdj | Adverb | A -> Adv | "warmly"
|| Function | Module | Type | Example | || Function | Module | Type | Example |
| PossPron | Noun | Pron -> Quant | my (house) | PossPron | Noun | Pron -> Quant | "my"
| PPartNP | Noun | NP -> V2 -> NP | the number squared | PPartNP | Noun | NP -> V2 -> NP | "the city seen"
| PNeg | Common | Pol | "" | PNeg | Common | Pol | ""
| PPos | Common | Pol | "" | PPos | Common | Pol | ""
| PredetNP | Noun | Predet -> NP -> NP | only the man | PredetNP | Noun | Predet -> NP -> NP | "only the man"
| PredSCVP | Sentence | SC -> VP -> Cl | that you go makes me happy | PredSCVP | Sentence | SC -> VP -> Cl | "that she sleeps is good"
| PredVP | Sentence | NP -> VP -> Cl | John walks | PredVP | Sentence | NP -> VP -> Cl | "she walks"
| PrepIP | Question | Prep -> IP -> IAdv | with whom | PrepIP | Question | Prep -> IP -> IAdv | "with whom"
| PrepNP | Adverb | Prep -> NP -> Adv | in the house | PrepNP | Adverb | Prep -> NP -> Adv | "in the house"
| ProgrVP | Idiom | VP -> VP | be sleeping | ProgrVP | Idiom | VP -> VP | "be sleeping"
| QuestCl | Question | Cl -> QCl | does John walk | QuestCl | Question | Cl -> QCl | "does she walk"
| QuestIAdv | Question | IAdv -> Cl -> QCl | why does John walk | QuestIAdv | Question | IAdv -> Cl -> QCl | "why does she walk"
| QuestIComp | Question | IComp -> NP -> QCl | where is John | QuestIComp | Question | IComp -> NP -> QCl | "where is she"
| QuestSlash | Question | IP -> Slash -> QCl | who does John love | QuestSlash | Question | IP -> Slash -> QCl | "whom does she love"
| QuestVP | Question | IP -> VP -> QCl | who walks | QuestVP | Question | IP -> VP -> QCl | "who walks"
| ReflA2 | Adjective | A2 -> AP | divisible by itself | ReflA2 | Adjective | A2 -> AP | "married to itself"
| ReflV2 | Verb | V2 -> VP | use itself | ReflV2 | Verb | V2 -> VP | "see himself"
| RelCl | Relative | Cl -> RCl | such that John loves her | RelCl | Relative | Cl -> RCl | "such that she loves him"
| RelCN | Noun | CN -> RS -> CN | house that John owns | RelCN | Noun | CN -> RS -> CN | "house that she buys"
| RelSlash | Relative | RP -> Slash -> RCl | whom John loves | RelSlash | Relative | RP -> Slash -> RCl | "that she loves"
| RelVP | Relative | RP -> VP -> RCl | who loves John | RelVP | Relative | RP -> VP -> RCl | "that loves her"
| SentAP | Adjective | AP -> SC -> AP | great that she won, uncertain if she did | SentAP | Adjective | AP -> SC -> AP | "good that she came"
| SentCN | Noun | CN -> SC -> CN | fact that John smokes, question if he does | SentCN | Noun | CN -> SC -> CN | "fact that she smokes"
| SgQuant | Noun | Quant -> QuantSg | this | SgQuant | Noun | Quant -> QuantSg | "this"
| SlashPrep | Sentence | Cl -> Prep -> Slash | (with whom) he walks | SlashPrep | Sentence | Cl -> Prep -> Slash | (with whom) "he walks"
| SlashV2 | Sentence | NP -> V2 -> Slash | (whom) he sees | SlashV2 | Sentence | NP -> V2 -> Slash | (whom) "he sees"
| SlashVVV2 | Sentence | NP -> VV -> V2 -> Slash | (whom) he wants to see | SlashVVV2 | Sentence | NP -> VV -> V2 -> Slash | (whom) "he wants to see"
| SubjS | Adverb | Subj -> S -> Adv | when he arrives | SubjS | Adverb | Subj -> S -> Adv | "when he came"
| TCond | Common | Tense | "" | TCond | Common | Tense | ""
| TEmpty | Text | Text | "" | TEmpty | Text | Text | ""
| TFut | Common | Tense | "" | TFut | Common | Tense | ""
| TExclMark | Text | Phr -> Text -> Text | John walks! ... | TExclMark | Text | Phr -> Text -> Text | "She walks!"
| TFullStop | Text | Phr -> Text -> Text | John walks. ... | TFullStop | Text | Phr -> Text -> Text | "She walks."
| TPast | Common | Tense | "" | TPast | Common | Tense | ""
| TPres | Common | Tense | "" | TPres | Common | Tense | ""
| TQuestMark | Text | Phr -> Text -> Text | Are you OK? ... | TQuestMark | Text | Phr -> Text -> Text | "Does she walk?"
| UseA2 | Adjective | A2 -> A | divisible | UseA2 | Adjective | A2 -> A | "married"
| UseCl | Sentence | Tense -> Ant -> Pol -> Cl -> S | John hadn't walked | UseCl | Sentence | Tense -> Ant -> Pol -> Cl -> S | "she wouldn't have walked"
| UseComp | Verb | Comp -> VP | be warm | UseComp | Verb | Comp -> VP | "be warm"
| UseN2 | Noun | N2 -> CN | son | UseN2 | Noun | N2 -> CN | "brother"
| UseN3 | Noun | N3 -> CN | flight | UseN3 | Noun | N3 -> CN | "connection"
| UseN | Noun | N -> CN | house | UseN | Noun | N -> CN | "house"
| UsePN | Noun | PN -> NP | John | UsePN | Noun | PN -> NP | "Paris"
| UsePron | Noun | Pron -> NP | he | UsePron | Noun | Pron -> NP | "she"
| UseQCl | Sentence | Tense -> Ant -> Pol -> QCl -> QS | where hadn't he walked | UseQCl | Sentence | Tense -> Ant -> Pol -> QCl -> QS | "where hadn't she walked"
| UseRCl | Sentence | Tense -> Ant -> Pol -> RCl -> RS | that he hadn't met | UseRCl | Sentence | Tense -> Ant -> Pol -> RCl -> RS | "that she hadn't seen"
| UseVQ | Verb | VQ -> V2 | ask (a question) | UseVQ | Verb | VQ -> V2 | "ask" (a question)
| UseVS | Verb | VS -> V2 | know (a secret) | UseVS | Verb | VS -> V2 | "know" (a secret)
| UseV | Verb | V -> VP | sleep | UseV | Verb | V -> VP | "sleep"
| UttAdv | Phrase | Adv -> Utt | here | UttAdv | Phrase | Adv -> Utt | "here"
| UttIAdv | Phrase | IAdv -> Utt | why | UttIAdv | Phrase | IAdv -> Utt | "why"
| UttImpPl | Phrase | Pol -> Imp -> Utt | (don't) help yourselves | UttImpPl | Phrase | Pol -> Imp -> Utt | "love yourselves"
| UttImpSg | Phrase | Pol -> Imp -> Utt | (don't) help yourself | UttImpSg | Phrase | Pol -> Imp -> Utt | "love yourself"
| UttIP | Phrase | IP -> Utt | who | UttIP | Phrase | IP -> Utt | "who"
| UttNP | Phrase | NP -> Utt | this man | UttNP | Phrase | NP -> Utt | "this man"
| UttQS | Phrase | QS -> Utt | is it good | UttQS | Phrase | QS -> Utt | "is it good"
| UttS | Phrase | S -> Utt | John walks | UttS | Phrase | S -> Utt | "she walks"
| UttVP | Phrase | VP -> Utt | to sleep | UttVP | Phrase | VP -> Utt | "to sleep"
| VocNP | Phrase | NP -> Voc | my friend | VocNP | Phrase | NP -> Voc | "my brother"
|| Function | Module | Type | Example | || Function | Module | Type | Example |
| num | Numeral | Sub1000000 -> Numeral | 2 | num | Numeral | Sub1000000 -> Numeral | "2"
| n2 | Numeral | Digit | 2 | n2 | Numeral | Digit | "2"
| n3 | Numeral | Digit | 3 | n3 | Numeral | Digit | "3"
| n4 | Numeral | Digit | 4 | n4 | Numeral | Digit | "4"
| n5 | Numeral | Digit | 5 | n5 | Numeral | Digit | "5"
| n6 | Numeral | Digit | 6 | n6 | Numeral | Digit | "6"
| n7 | Numeral | Digit | 7 | n7 | Numeral | Digit | "7"
| n8 | Numeral | Digit | 8 | n8 | Numeral | Digit | "8"
| n9 | Numeral | Digit | 9 | n9 | Numeral | Digit | "9"
| pot01 | Numeral | Sub10 | 1 | pot01 | Numeral | Sub10 | "1"
| pot0 | Numeral | Digit -> Sub10 | 3 | pot0 | Numeral | Digit -> Sub10 | "3"
| pot110 | Numeral | Sub100 | 10 | pot110 | Numeral | Sub100 | "10"
| pot111 | Numeral | Sub100 | 11 | pot111 | Numeral | Sub100 | "11"
| pot1to19 | Numeral | Digit -> Sub100 | 18 | pot1to19 | Numeral | Digit -> Sub100 | "18"
| pot0as1 | Numeral | Sub10 -> Sub100 | 3 | pot0as1 | Numeral | Sub10 -> Sub100 | "3"
| pot1 | Numeral | Digit -> Sub100 | 50 | pot1 | Numeral | Digit -> Sub100 | "50"
| pot1plus | Numeral | Digit -> Sub10 -> Sub100 | 54 | pot1plus | Numeral | Digit -> Sub10 -> Sub100 | "54"
| pot1as2 | Numeral | Sub100 -> Sub1000 | 99 | pot1as2 | Numeral | Sub100 -> Sub1000 | "99"
| pot2 | Numeral | Sub10 -> Sub1000 | 600 | pot2 | Numeral | Sub10 -> Sub1000 | "600"
| pot2plus | Numeral | Sub10 -> Sub100 -> Sub1000 | 623 | pot2plus | Numeral | Sub10 -> Sub100 -> Sub1000 | "623"
| pot2as3 | Numeral | Sub1000 -> Sub1000000 | coercion of 1..999 | pot2as3 | Numeral | Sub1000 -> Sub1000000 | "999"
| pot3 | Numeral | Sub1000 -> Sub1000000 | m * 1000 | pot3 | Numeral | Sub1000 -> Sub1000000 | "53000"
| pot3plus | Numeral | Sub1000 -> Sub1000 -> Sub1000000 | m * 1000 + n | pot3plus | Numeral | Sub1000 -> Sub1000 -> Sub1000000 | "53201"

View File

@@ -1,5 +1,7 @@
GF=gf GF=gf
RTS=+RTS -M800M -K100M RTS=+RTS -M800M -K100M
RTSS=+RTS -M1800M -K100M
GFCA=$(GF) -nocf
GFCC=$(GF) -nocf -make GFCC=$(GF) -nocf -make
GFC=$(GFCC) -src GFC=$(GFCC) -src
GFCP=$(GFC) -preproc=./mkPresent GFCP=$(GFC) -preproc=./mkPresent
@@ -33,7 +35,7 @@ alltenses:
cp -p */*.gfc */*.gfr ../alltenses cp -p */*.gfc */*.gfr ../alltenses
langs: langs:
echo "s ;; pm | wf langs.gfcm" | $(GFCC) -path=alltenses:prelude ../alltenses/Lang???.gfc $(RTS) echo "s ;; pm | wf langs.gfcm" | $(GFCA) -path=alltenses:prelude ../alltenses/Lang???.gfc $(RTSS)
present: present:

View File

@@ -9,7 +9,6 @@ resource ConstructX = open CommonX in {
mkAdv : Str -> Adv = \s -> {s = s ; lock_Adv = <>} ; mkAdv : Str -> Adv = \s -> {s = s ; lock_Adv = <>} ;
mkAdV : Str -> AdV = \s -> {s = s ; lock_AdV = <>} ; mkAdV : Str -> AdV = \s -> {s = s ; lock_AdV = <>} ;
mkAdA : Str -> AdA = \s -> {s = s ; lock_AdA = <>} ; mkAdA : Str -> AdA = \s -> {s = s ; lock_AdA = <>} ;
mkAdS : Str -> AdS = \s -> {s = s ; lock_AdS = <>} ;
mkAdN : Str -> AdN = \s -> {s = s ; lock_AdN = <>} ; mkAdN : Str -> AdN = \s -> {s = s ; lock_AdN = <>} ;
mkIAdv : Str -> IAdv = \s -> {s = s ; lock_IAdv = <>} ; mkIAdv : Str -> IAdv = \s -> {s = s ; lock_IAdv = <>} ;
mkCAdv : Str -> CAdv = \s -> {s = s ; lock_CAdv = <>} ; mkCAdv : Str -> CAdv = \s -> {s = s ; lock_CAdv = <>} ;

View File

@@ -80,7 +80,9 @@ redInfo (c,info) = errIn ("decompiling abstract" +++ show c) $ do
xx' <- mapM redArgVar xx xx' <- mapM redArgVar xx
body' <- redCTerm body body' <- redCTerm body
ppr' <- redCTerm ppr ppr' <- redCTerm ppr
return $ G.CncFun Nothing (Yes (F.mkAbs xx' body')) (Yes ppr') cat' <- redIdent cat
return $ G.CncFun (Just (cat', ([],F.typeStr))) -- Nothing
(Yes (F.mkAbs xx' body')) (Yes ppr')
AnyInd b c -> liftM (G.AnyInd b) $ redIdent c AnyInd b c -> liftM (G.AnyInd b) $ redIdent c

View File

@@ -82,7 +82,7 @@ mkCncGroups opts0 ((res,path),files) = do
return return
(\cat s -> (\cat s ->
errVal ([],"No parse") $ errVal ([],"No parse") $
optParseArgErrMsg (options [newMParser, firstCat cat, beVerbose]) gr s >>= optParseArgErrMsg (options [newFParser, firstCat cat, beVerbose]) gr s >>=
(\ (ts,e) -> return (map tree2exp ts, e)) , (\ (ts,e) -> return (map tree2exp ts, e)) ,
isKnownWord gr) isKnownWord gr)
putStrLn "Building parser" putStrLn "Building parser"

View File

@@ -204,7 +204,9 @@ renameTerm env vars = ren vars where
| elem r vs -> return trm -- var proj first | elem r vs -> return trm -- var proj first
| otherwise -> case renid (Q r (label2ident l)) of -- qualif second | otherwise -> case renid (Q r (label2ident l)) of -- qualif second
Ok t -> return t Ok t -> return t
_ -> liftM (flip P l) $ renid t -- const proj last _ -> case liftM (flip P l) $ renid t of
Ok t -> return t -- const proj last
_ -> prtBad "unknown qualified constant" trm
_ -> composOp (ren vs) trm _ -> composOp (ren vs) trm

View File

@@ -51,6 +51,8 @@ lookupResDef gr m c = look True m c where
CncCat (Yes ty) _ _ -> lock c ty CncCat (Yes ty) _ _ -> lock c ty
CncCat _ _ _ -> lock c defLinType CncCat _ _ _ -> lock c defLinType
CncFun (Just (cat,_)) (Yes tr) _ -> unlock cat tr
CncFun _ (Yes tr) _ -> unlock c tr CncFun _ (Yes tr) _ -> unlock c tr
AnyInd _ n -> look False n c AnyInd _ n -> look False n c
@@ -73,7 +75,7 @@ lookupResType gr m c = do
-- used in reused concrete -- used in reused concrete
CncCat _ _ _ -> return typeType CncCat _ _ _ -> return typeType
CncFun (Just (cat,(cont,val))) _ _ -> do CncFun (Just (cat,(cont@(_:_),val))) _ _ -> do
val' <- lock cat val val' <- lock cat val
return $ mkProd (cont, val', []) return $ mkProd (cont, val', [])
CncFun _ _ _ -> lookFunType m m c CncFun _ _ _ -> lookFunType m m c

View File

@@ -83,7 +83,8 @@ parseStringC opts0 sg cat s
t:_ -> t t:_ -> t
_ -> [] ---- no support for undet. tok. _ -> [] ---- no support for undet. tok.
ts <- checkErr $ New.parse algorithm strategy (pInfo sg) (absId sg) cat toks ts <- checkErr $ New.parse algorithm strategy (pInfo sg) (absId sg) cat toks
ts' <- mapM (checkErr . annotate (stateGrammarST sg) . refreshMetas []) ts ts' <- checkErr $
allChecks $ map (annotate (stateGrammarST sg) . refreshMetas []) ts
return $ optIntOrAll opts flagNumber ts' return $ optIntOrAll opts flagNumber ts'
@@ -115,7 +116,8 @@ trees2trms opts sg cn as ts0 info = do
) )
(ts1,ss) <- checkErr $ mapErrN 1 postParse ts01 (ts1,ss) <- checkErr $ mapErrN 1 postParse ts01
if null ts1 then raise ss else return () if null ts1 then raise ss else return ()
ts2 <- mapM (checkErr . annotate gr . refreshMetas [] . trExp) ts1 ---- ts2 <- checkErr $
allChecks $ map (annotate gr . refreshMetas [] . trExp) ts1 ----
if forgive then return ts2 else do if forgive then return ts2 else do
let tsss = [(t, allLinsOfTree gr cn t) | t <- ts2] let tsss = [(t, allLinsOfTree gr cn t) | t <- ts2]
ps = [t | (t,ss) <- tsss, ps = [t | (t,ss) <- tsss,
@@ -127,7 +129,6 @@ trees2trms opts sg cn as ts0 info = do
unlines (nub (map sstr (concatMap snd tsss))) unlines (nub (map sstr (concatMap snd tsss)))
else "" else ""
else return ps else return ps
if verb if verb
then checkWarn $ " the token list" +++ show as ++++ unknownWords sg as +++++ info then checkWarn $ " the token list" +++ show as ++++ unknownWords sg as +++++ info
else return () else return ()
@@ -140,6 +141,8 @@ trees2trms opts sg cn as ts0 info = do
verb = oElem beVerbose opts verb = oElem beVerbose opts
forgive = oElem forgiveParse opts forgive = oElem forgiveParse opts
---- Operatins.allChecks :: ErrorMonad m => [m a] -> m [a]
unknownWords sg ts = case filter noMatch [t | t@(TS _) <- ts] of unknownWords sg ts = case filter noMatch [t | t@(TS _) <- ts] of
[] -> "where all words are known" [] -> "where all words are known"
us -> "with the unknown tokens" +++ show us --- needs to be fixed for literals us -> "with the unknown tokens" +++ show us --- needs to be fixed for literals