]> hydra-www.ietfng.org Git - dyna2/commitdiff
tweaks
authortimv <tim.f.vieira@gmail.com>
Tue, 11 Dec 2012 02:56:59 +0000 (21:56 -0500)
committertimv <tim.f.vieira@gmail.com>
Tue, 11 Dec 2012 02:56:59 +0000 (21:56 -0500)
src/Dyna/Analysis/ANF.hs
src/Dyna/Backend/Python.hs

index eda63cedbcec7f2b3c9973c027a43570df77be7d..a8e62cc730202b6a652e86a1a2dc9c901143b6a6 100644 (file)
@@ -319,7 +319,7 @@ normTerm c (t T.:~ s) = normTerm_ (ECFunctor,if c then ADEval else ADQuote)
 ------------------------------------------------------------------------}}}
 -- Normalize a Rule                                                     {{{
 
-data FRule = FRule { fr_functor :: DVar      -- timv: rename type to FRule?
+data FRule = FRule { fr_functor :: DVar
                    , fr_aggregator :: DAgg
                    , fr_side :: [DVar]
                    , fr_result :: DVar
index 38b02c6d5810787f06f689344ad57e5fdfe11071..a41077fe2d565284e224312f8a3521ebe51b3831 100644 (file)
@@ -61,7 +61,7 @@ pdope (OPCheck v val) = hsep ["assert", pretty v, "==", pretty val]
 pdope (OPGetArgsIf vs id f) =
        tupled (map pretty vs)
    <+> equals
-   <+> functorIndirect "peel" f vs <> (parens $ pretty id)
+   <+> "peel" <> (parens $ fa f vs <> comma <> pretty id)
 
 pdope (OPBuild v vs f) = pretty v <+> equals
       <+> functorIndirect "build" f vs
@@ -76,6 +76,8 @@ pdope (OPIter o m f) =
           "for" <+> (tupled $ filterBound mo)
                 <+> "in" <+> functorIndirect "chart" f m <> pslice mo <> colon
 
+fa f a = dquotes $ pretty f <> "/" <> (text $ show $ length a)
+
 pslice = brackets . sepBy ","
          . map (\x -> case x of (MF v) -> ":" ; (MB v) -> pretty v)
 
@@ -90,13 +92,12 @@ pf f vs = pretty f <> (tupled $ map pretty vs)
 
 -- XXX This belongs elsewhere.
 --
--- XXX This guy wants span information.
+-- XXX This guy wants span information; he's got it now use it.
 --
 -- timv: might want to fuse these into one circuit
 --
 combinePlans :: [(FRule,[(DFunctAr, Maybe (Cost,Action))])] ->
                 Either String (M.Map DFunctAr [(FRule, Cost, Action)])    -- all plans for functor/arity
-                                                                          -- XXX: are FDR's unique keys? suppose a rule is repeated?
 combinePlans = go (M.empty)
  where
   go m []             = Right m
@@ -117,8 +118,6 @@ combinePlans = go (M.empty)
     nel (Just x) = x
 
 
--- timv: consider flattening FRUle and ANFState
-
 py (cruxf,cruxa) (FRule h _ _ r span _) dope =
            "@register" <> (parens $ dquotes $ pretty cruxf <> "/" <> (text $ show cruxa))
    `above` "def _(_H, _V):"
@@ -171,7 +170,6 @@ processFile_ fileName fh = do
                 displayIO fh $ renderPretty 1.0 100
                           $ py fa r dope
                 hPutStrLn fh ""
---            hPutStrLn fh ""
 
  where
   headVar = "_H"