Experimenting with the new parser:

Experimenting with the new parser:
p -cat=S -new -parser=CF-BU "John walks"
This commit is contained in:
aarne
2003-10-06 08:16:05 +00:00
parent 3aa5921fbc
commit 0ac49ec12f
4 changed files with 56 additions and 2 deletions

15
grammars/basic/Basic.gf Normal file
View File

@@ -0,0 +1,15 @@
abstract Basic = {
cat
S ; NP ; A1 ; CN ;
fun
PredA1 : NP -> A1 -> S ;
CondS : S -> S -> S ;
DisjA1 : A1 -> A1 -> A1 ;
Every : CN -> NP ;
ModA1 : CN -> A1 -> CN ;
Number : CN ;
Even : A1 ; Odd : A1 ; Prime : A1 ;
Zero : NP ;
}

27
grammars/basic/English.gf Normal file
View File

@@ -0,0 +1,27 @@
concrete English of Basic = {
lincat
S = {s : Str} ; NP = {s : Str} ; A1 = {s : Str} ; CN = {s : Str} ;
lin PredA1 Q F =
{s = Q.s ++ "is" ++ F.s} ;
lin CondS A B =
{s = "if" ++ A.s ++ "then" ++ B.s} ;
lin DisjA1 F G =
{s = F.s ++ "or" ++ G.s} ;
lin Every A =
{s = "every" ++ A.s} ;
lin ModA1 A F =
{s = F.s ++ A.s} ;
lin Number =
{s = "number"} ;
lin Even =
{s = "even"} ;
lin Odd =
{s = "odd"} ;
lin Prime =
{s = "prime"} ;
lin Zero =
{s = "zero"} ;
}

View File

@@ -19,6 +19,8 @@ import Option
import Custom
import ShellState
import qualified ExportParser as N
import Operations
import List (nub)
@@ -35,7 +37,17 @@ parseStringMsg os sg cat s = do
return (ts,unlines ss)
parseStringC :: Options -> StateGrammar -> CFCat -> String -> Check [Tree]
parseStringC opts0 sg cat s = do
parseStringC opts0 sg cat s
---- to test peb's new parser 6/10/2003
| oElem newParser opts0 = do
let pm = maybe "" id $ getOptVal opts0 useParser -- -parser=pm
gr = grammar sg
ps <- checkErr $ N.newParser pm gr (cfCat2Cat cat) s
checkWarn $ unlines ps
return []
| otherwise = do
let opts = unionOptions opts0 $ stateOptions sg
cf = stateCF sg
gr = stateGrammarST sg

View File

@@ -1 +1 @@
module Today where today = "Fri Oct 3 14:06:22 CEST 2003"
module Today where today = "Mon Oct 6 10:50:56 CEST 2003"