fixed some tutorial grammars and updated embedded section (JavaScript and web TODO)

This commit is contained in:
aarne
2008-11-11 09:21:59 +00:00
parent ca59050abc
commit db18350b1e
9 changed files with 163 additions and 100 deletions

View File

@@ -0,0 +1,21 @@
module Main where
import PGF
import TransferDef (transfer)
main :: IO ()
main = do
gr <- readPGF "Query.pgf"
loop (translate transfer gr)
loop :: (String -> String) -> IO ()
loop trans = do
s <- getLine
if s == "quit" then putStrLn "bye" else do
putStrLn $ trans s
loop trans
translate :: (Tree -> Tree) -> PGF -> String -> String
translate tr gr s = case parseAllLang gr (startCat gr) s of
(lg,t:_):_ -> linearize gr lg (tr t)
_ -> "NO PARSE"