1
0
forked from GitHub/gf-core

Morphological analysis and glueing.

This commit is contained in:
aarne
2003-11-10 07:55:45 +00:00
parent 4c99687f21
commit 249d506f58
13 changed files with 84 additions and 34 deletions

View File

@@ -172,6 +172,8 @@ data Exp =
| EConcat Exp Exp
| EGlue Exp Exp
| ELet [LocDef] Exp
| ELetb [LocDef] Exp
| EWhere Exp [LocDef]
| EEqs [Equation]
| ELString LString
| ELin Ident

View File

@@ -321,6 +321,8 @@ instance Print Exp where
EConcat exp0 exp -> prPrec i 0 (concat [prt 1 exp0 , ["++"] , prt 0 exp])
EGlue exp0 exp -> prPrec i 0 (concat [prt 1 exp0 , ["+"] , prt 0 exp])
ELet locdefs exp -> prPrec i 0 (concat [["let"] , ["{"] , prt 0 locdefs , ["}"] , ["in"] , prt 0 exp])
ELetb locdefs exp -> prPrec i 0 (concat [["let"] , prt 0 locdefs , ["in"] , prt 0 exp])
EWhere exp locdefs -> prPrec i 0 (concat [prt 1 exp , ["where"] , ["{"] , prt 0 locdefs , ["}"]])
EEqs equations -> prPrec i 0 (concat [["fn"] , ["{"] , prt 0 equations , ["}"]])
ELString lstring -> prPrec i 4 (concat [prt 0 lstring])
ELin id -> prPrec i 2 (concat [["Lin"] , prt 0 id])

View File

@@ -357,6 +357,8 @@ transExp x = case x of
where
tryLoc (c,(mty,Just e)) = return (c,(mty,e))
tryLoc (c,_) = Bad $ "local definition of" +++ GP.prt c +++ "without value"
ELetb defs exp -> transExp $ ELet defs exp
EWhere exp defs -> transExp $ ELet defs exp
ELString (LString str) -> return $ G.K str
ELin id -> liftM G.LiT $ transIdent id