summaryrefslogtreecommitdiff
path: root/old-examples/tutorial/semantics/Answer.hs
blob: 08a76c5f1f5f16ea5b2595745ef6cda3a04cf7f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Main where

import GSyntax
import AnswerBase
import GF.GFCC.API

main :: IO ()
main = do
  gr <- file2grammar "base.gfcc"
  loop gr

loop :: MultiGrammar -> IO ()
loop gr = do
  s <- getLine
  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