1
0
forked from GitHub/gf-core

Moved the different versions of the toy0 concrete modules to different subdirectories.

This commit is contained in:
bringert
2007-06-27 12:38:24 +00:00
parent 67857cb146
commit 54d5325171
7 changed files with 7 additions and 4 deletions

View File

@@ -0,0 +1,39 @@
-- grammar from Chapter 2 of the Regulus book
flags startcat=MAIN ;
cat
MAIN ; NP ; Noun ; Spec ;
fun
Main : NP -> MAIN ;
SpecNoun : Spec -> Noun -> NP ;
One, Two : Spec ;
Felis, Canis : Noun ;
param
Number = Sg | Pl ;
lincat
Spec = {s : Str ; n : Number} ;
Noun = {s : Number => Str} ;
MAIN,NP = {s : Str} ;
lin
Main np = np ;
SpecNoun spec noun = {s = spec.s ++ noun.s ! spec.n} ;
One = {s = "one" ; n = Sg} ;
Two = {s = "two" ; n = Pl} ;
Felis = regNoun "cat" ;
Canis = regNoun "dog" ;
oper
regNoun : Str -> {s : Number => Str} = \s -> {
s = table {
Sg => s ;
Pl => s + "s"
}
} ;