]> hydra-www.ietfng.org Git - dyna2/commitdiff
Small cleanups & update TODO
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 5 Jun 2013 00:30:27 +0000 (20:30 -0400)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Wed, 5 Jun 2013 00:30:27 +0000 (20:30 -0400)
Makefile
docs/TODO.LSA
src/Dyna/Analysis/ANF.hs
src/Dyna/Analysis/Mode/Selftest/Contexts.hs
src/Dyna/Analysis/RuleMode.hs
src/Dyna/XXX/HList.hs

index 6945d0c5410e10e4327c281c0e296769d471ba69..594cd87493d1586c7e50621e5bab18f9719dca6e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,13 @@
 # -*-  indent-tabs-mode:t;  -*-
 
-all: build
+all: deps build
 
 upstream:
        git submodule init
-       git submodule update external/ekmett-parsers external/ekmett-trifecta
-       cabal install --user --enable-tests --only-dependencies \
-      external/ekmett-parsers external/ekmett-trifecta .
-       cabal install --user external/ekmett-parsers external/ekmett-trifecta 
+       git submodule update external/ekmett-parsers external/ekmett-trifecta
+       cabal install --user --enable-tests --only-dependencies \
+       #  external/ekmett-parsers external/ekmett-trifecta .
+       # cabal install --user external/ekmett-parsers external/ekmett-trifecta
 
 deps:
        alex --version || cabal install alex
@@ -18,7 +18,7 @@ build:
        cabal configure --user --enable-tests
        cabal build
 
-tests:
+test tests: build
        dist/build/dyna-selftests/dyna-selftests
        # cabal test
 
index 7d41972f3e46517db5a70751a8a337f2d1d9f425..40438c162073e042062fb5f441aff617bf4ff5f8 100644 (file)
@@ -11,9 +11,10 @@ Parse QMode pragmas
 
 List notation
 
------ Frontend
+Strict end-of-rule punctuation, warn if blank line at plausible end-of-rule
+position? (polish for LSA)
 
-:= syntactic sugar
+----- Frontend
 
 ----- Analysis
 
@@ -31,35 +32,36 @@ Unification alias tracking (after LSA?)
 
 ----- Backend
 
-Check that we have = aggregation working correctly.
+",/2" runtime error if first argument is not true or false
+    Probably OK for this one to crash the program!
 
-Special error value (for = agg violation, div by 0, ...)
-       Some flavor of "root cause" pointer / string / ... ?
+Check that we have = aggregation working correctly.
 
 Could we maybe get a better chart representation?
        And better queries into the chart?  We should be able to extract
        adorned queries from the planner's output without too much effort...
 
+Prioritization heuristic
+
 Maybe something better for initializers or update API? (Low priority)
 
 DOpAMine improvements for non-ground structure (probably no time!)
 
 ----- Documentation
 
+Forward port shortest path tutorial
+
 Mention ^C in documentation for diverging programs.
 
 Be sure to mention, repeatedly, that this is experimental software and is
 likely to break both early and often.  Explain the difference between panic
 messages and errors.
 
------ Whole pipeline
+----- REPL
 
-Need some better mechanism for executing queries after the agenda empties.
-       Take query, feed back to compiler / planner / ...
-               In general, we'd need to indicate which set of things we are
-               at present maintaining and possibly feed the whole program back
-               through the pipeline... if we stick with everything being
-               materialized, we can just feed the query through.
+Make use of resumable parsing functionality
+
+----- Whole pipeline
 
 Can we extract backpointers from the chart or generate code to do so?
 
@@ -69,3 +71,21 @@ Can we run anything on e.g. WSJ with L0 grammar?
 How about... (other things students might want to do)
        train a log-linear model (e.g. by using := for weights)
        find the K most-frequent bigrams (even from the repl?)
+
+----- Things that still have bits and bobs pending
+
+Queries (initializers), new rule insertions (both plans and initializers)
+
+Need some better mechanism for executing queries after the agenda empties.
+       Take query, feed back to compiler / planner / ...
+               In general, we'd need to indicate which set of things we are
+               at present maintaining and possibly feed the whole program back
+               through the pipeline... if we stick with everything being
+               materialized, we can just feed the query through.
+
+DOpAMine improvements for logging of hyper-edges
+    Right now we manage this through timv's cleverness in the backend,
+    rather than anything formal.
+
+Graphical view of the hypergraph
+    Tim has something pretty neat working
index 3095ca0e9f18528b29bbef975d4091d122a0d672..b29ec2c75539de4a42773f53717d89b0159716c2 100644 (file)
@@ -301,6 +301,12 @@ normTerm_ _   ss (P.TFunctor f [t T.:~ st]) | f == dynaQuoteOper = do
 -- Evaluation is a little different: in addition to forcing the context to
 -- evaluate, it must also evaluate if the context from on high is one of
 -- evaluation!
+--
+-- XXX This is not right.  Consider ":-dispos &pair(*,*)."  If I want to
+-- evaluate a pair/2 in evaluation context, then I need to write &(*pair(1,2)),
+-- so that the & suppresses the context's influence and * overrides the
+-- pair's disposition.... actually that's true of variables, too.  f(*X)
+-- does not mean what it should in the new syntax.
 normTerm_ c   ss (P.TFunctor f [t T.:~ st]) | f == dynaEvalOper =
     normTerm_ (ECExplicit,ADEval) (st:ss) t
     >>= \nt -> case c of
index 5eadd1ae5aa1df599a4db2180a9dc97a17b29ebd..55e4361bd3bbd023639d5f6b7758f277a257002d 100644 (file)
@@ -83,10 +83,10 @@ alias_unifyVF n1 n2 =
   fmap fst $ runIdentity
            $ flip CA.runSIMCT (CA.allFreeSIMCtx [vA,vB])
            $ do
-              flip runReaderT (UnifParams True False) $ do
-                FA.unifyUnaliasedNV n1 vA
+              _ <- flip runReaderT (UnifParams True False) $ do
+                _ <- FA.unifyUnaliasedNV n1 vA
                 FA.unifyUnaliasedNV n2 vB
-              FA.unifyVF True (const $ return True) vA G [vB]
+              _ <- FA.unifyVF True (const $ return True) vA G [vB]
               FA.expandV vA
  where
    vA = "A"
index adc05ac4b64a436bf3735d51521f765e875c1abc..f9442080c7d5591e63d64e4e45bc1f4f7586cb7a 100644 (file)
@@ -150,10 +150,9 @@ fgn v cf cg cn = do
 
 possible :: (Monad m)
          => BackendPossible fbs
-         -> Rule
          -> Crux DVar TBase
          -> SIMCT m DFunct (Actions fbs)
-possible fp cr =
+possible fp cr =
   case cr of
     -- XXX This is going to be such a pile.  We really, really should have
     -- unification crank out a series of DOpAMine opcodes for us, but for
@@ -210,20 +209,22 @@ possible fp r cr =
                                  (throwError UFExDomain)
 
     -- XXX Indirect evaluation is not yet supported
-    Left (eix, CEval _ _) -> dynacSorry $ "Indir eval"
-                                      <+> parens ("eix=" <> pretty eix)
-                                      <+> "in rule at"
-                                      </> prettySpanLoc (r_span r)
+    Left (_, CEval _ _) -> throwError UFExDomain
 
     -- Evaluation
     Left (_, CCall vo vis funct) -> do
       is <- mapM mkMV vis 
       o  <- mkMV vo
       case fp (funct,is,o) of
-          -- XXX Not a built-in, so we assume that it can be iterated in full.
+          -- XXX Not a built-in, so we assume that it can be
+          -- iterated in full.
         Left False      -> do mapM_ bind (vo:vis)
                               return [OPIter o is funct DetNon Nothing]
+
+          -- Builtin called in improper mode; bail on this plan
         Left True        -> throwError UFExDomain
+
+          -- Builtin called in accessible mode; apply bindings and return
         Right (BAct a m) -> do runReaderT
                                  (mapM_ (uncurry $ flip unifyUnaliasedNV) m)
                                  (UnifParams True True) -- XXX Live?
@@ -240,39 +241,6 @@ possible fp r cr =
                            (throwError UFExDomain)
      bind x = runReaderT (unifyVU x) (UnifParams False False)
 
-------------------------------------------------------------------------}}}
--- ANF to Cruxes                                                        {{{
-
-{-
-anfVars :: ANFState -> S.Set DVar
-anfVars (AS { as_evals = evals, as_unifs = unifs, as_assgn = assgns } ) =
-  S.unions [ M.foldWithKey (\k v s -> S.insert k (go1 v s)) S.empty evals
-           , M.foldWithKey (\k v s -> S.insert k (go2 v s)) S.empty assgns
-           , foldr (\(v1,v2) s -> S.insert v1 (S.insert v2 s)) S.empty unifs
-           ]
-  where
-   go s (_,vs) = S.union s (S.fromList vs)
-   go1 e s = either (flip S.insert s) (go s) e
-   go2 e s = either (const s) (go s) e
-
-
-eval_cruxes :: ANFState -> [EvalCrux DVar]
-eval_cruxes = M.foldrWithKey (\o i -> (crux o i :)) [] . as_evals
- where
-  crux :: DVar -> EVF -> EvalCrux DVar
-  crux o (Left v) = CEval o v
-  crux o (Right (f,as)) = CCall o as f
-
-unif_cruxes :: ANFState -> [UnifCrux DVar NTV]
-unif_cruxes (AS { as_assgn = assigns, as_unifs = unifs }) =
-     M.foldrWithKey (\o i -> (crux o i :)) [] assigns
-  ++ map (\(v1,v2) -> CAssign v1 (NTVar v2)) unifs
- where
-  crux :: DVar -> EBF -> UnifCrux DVar NTV
-  crux o (Left  x)              = CAssign o (NTBase x)
-  crux o (Right (f,as))         = CStruct o as f
--}
-
 ------------------------------------------------------------------------}}}
 -- Costing Plans                                                        {{{
 
@@ -458,12 +426,12 @@ planUpdate :: BackendPossible fbs
            -> SIMCtx DVar
            -> Maybe (Cost, Actions fbs)
 planUpdate bp r sc anf mi ictx = fmap (second (finalizePlan r)) $
-  bestPlan $ planner_ (possible bp r) sc anf (Just mi) ictx
+  bestPlan $ planner_ (possible bp) sc anf (Just mi) ictx
 
 planInitializer :: BackendPossible fbs -> Rule -> Maybe (Cost, Actions fbs)
 planInitializer bp r = fmap (second (finalizePlan r)) $
   let cruxes = r_cruxes r in
-  bestPlan $ planner_ (possible bp r) simpleCost cruxes Nothing
+  bestPlan $ planner_ (possible bp) simpleCost cruxes Nothing
              (allFreeSIMCtx $ S.toList $ allCruxVars cruxes)
 
 -- | Given a particular crux and the remaining evaluation cruxes in a rule, 
index 4ca2865021b271df5ec6fdb0e2159115baa72f00..923e9e5b7e2ba6e012a5d6dd12285f7218827410 100644 (file)
@@ -106,7 +106,7 @@ instance (EqLen xs ys) => EqLen (x ': xs) (y ': ys)
 
 infixr 5 :+
 
--- | A heterogenous list
+-- | A heterogeneous list
 data HList a where
  HN   :: HList '[]
  (:+) :: a -> HList b -> HList (a ': b)
@@ -144,7 +144,7 @@ hrlmap' f (a :+ as) = f a :+ (hrlmap' f as)
 
 infixr 5 :++
 
--- | A heterogenous list in which every element is the image of some
+-- | A heterogeneous list in which every element is the image of some
 -- type-function @r :: * -> *@.
 data HRList (r :: k -> *) (a :: [k]) where
  HRN   :: HRList r '[]
@@ -171,7 +171,7 @@ hrlmapa :: (Applicative m)
 hrlmapa _  HRN       = pure HRN
 hrlmapa f (a :++ as) = liftA2 (:++) (f a) (hrlmapa f as)
 
--- | Eliminate a HRList to a homogenous list
+-- | Eliminate a HRList to a homogeneous list
 hrlproj :: (forall a . r a -> b) -> HRList r t -> [b]
 hrlproj _  HRN       = []
 hrlproj f (a :++ as) = f a : (hrlproj f as)