diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2012-08-29 11:43:02 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2012-08-29 11:43:02 +0000 |
| commit | f8fe23fda7b97d5301bfb2ec1d89ce9967c5b200 (patch) | |
| tree | a2db1d1dbe1cd294a7f323abb0123ea8c551fc82 /src/runtime/haskell/PGF/Data.hs | |
| parent | 27196778ace6de265407947a21a5b0eb3fd0caf8 (diff) | |
A basic infrastructure for generating Teyjus bytecode from the GF abstract syntax
Diffstat (limited to 'src/runtime/haskell/PGF/Data.hs')
| -rw-r--r-- | src/runtime/haskell/PGF/Data.hs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/runtime/haskell/PGF/Data.hs b/src/runtime/haskell/PGF/Data.hs index f382601a8..357dcc92e 100644 --- a/src/runtime/haskell/PGF/Data.hs +++ b/src/runtime/haskell/PGF/Data.hs @@ -9,6 +9,7 @@ import qualified Data.Set as Set import qualified Data.IntMap as IntMap import qualified Data.IntSet as IntSet import qualified GF.Data.TrieMap as TMap +import qualified Data.ByteString as BS import Data.Array.IArray import Data.Array.Unboxed import Data.List @@ -26,12 +27,13 @@ data PGF = PGF { } data Abstr = Abstr { - aflags :: Map.Map CId Literal, -- ^ value of a flag - funs :: Map.Map CId (Type,Int,Maybe [Equation],Double), -- ^ type, arrity and definition of function + probability - cats :: Map.Map CId ([Hypo],[(Double, CId)]) -- ^ 1. context of a category - -- ^ 2. functions of a category. The order in the list is important, - -- this is the order in which the type singatures are given in the source. - -- The termination of the exhaustive generation might depend on this. + aflags :: Map.Map CId Literal, -- ^ value of a flag + funs :: Map.Map CId (Type,Int,Maybe [Equation],Double,BCAddr), -- ^ type, arrity and definition of function + probability + cats :: Map.Map CId ([Hypo],[(Double, CId)],BCAddr), -- ^ 1. context of a category + -- ^ 2. functions of a category. The order in the list is important, + -- this is the order in which the type singatures are given in the source. + -- The termination of the exhaustive generation might depend on this. + code :: BS.ByteString } data Concr = Concr { @@ -70,6 +72,7 @@ data CncFun = CncFun CId {-# UNPACK #-} !(UArray LIndex SeqId) deriving (Eq,Ord, type Sequence = Array DotPos Symbol type FunId = Int type SeqId = Int +type BCAddr = Int data Alternative = Alt [Token] [String] @@ -102,8 +105,8 @@ emptyPGF = PGF { haveSameFunsPGF :: PGF -> PGF -> Bool haveSameFunsPGF one two = let - fsone = [(f,t) | (f,(t,_,_,_)) <- Map.toList (funs (abstract one))] - fstwo = [(f,t) | (f,(t,_,_,_)) <- Map.toList (funs (abstract two))] + fsone = [(f,t) | (f,(t,_,_,_,_)) <- Map.toList (funs (abstract one))] + fstwo = [(f,t) | (f,(t,_,_,_,_)) <- Map.toList (funs (abstract two))] in fsone == fstwo -- | This is just a 'CId' with the language name. |
