summaryrefslogtreecommitdiff
path: root/examples/tutorial/semantics/Answer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tutorial/semantics/Answer.hs')
-rw-r--r--examples/tutorial/semantics/Answer.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/tutorial/semantics/Answer.hs b/examples/tutorial/semantics/Answer.hs
index b874b8bd2..08a76c5f1 100644
--- a/examples/tutorial/semantics/Answer.hs
+++ b/examples/tutorial/semantics/Answer.hs
@@ -12,9 +12,10 @@ main = do
loop :: MultiGrammar -> IO ()
loop gr = do
s <- getLine
- let t:_ = parse gr "BaseEng" "S" s
- putStrLn $ showTree t
- let p = iS $ fg t
- putStrLn $ show p
+ case parse gr "BaseEng" "Question" s of
+ [] -> putStrLn "no parse"
+ ts -> mapM_ answer ts
loop gr
+ where
+ answer t = putStrLn $ linearize gr "BaseEng" $ gf $ question2answer $ fg t