metaSMT git

metaSMT/frontend/SAT.hpp

Go to the documentation of this file.
00001 #pragma once
00002 #include "../tags/SAT.hpp"
00003 #include "../transform/rewrite.hpp"
00004 #include <boost/proto/core.hpp>
00005 #include <boost/proto/transform.hpp>
00006 
00007 // debug includes
00008 #include <cstdio>
00009 #include <boost/proto/debug.hpp>
00010 #include <boost/mpl/int.hpp> 
00011 
00012 namespace metaSMT {
00013    namespace SAT {
00014      namespace proto=boost::proto;
00015      
00016     /*** SAT/clase grammar ***/
00017     struct SAT_Domain;
00018 
00019     struct Literal
00020     : proto::or_<
00021         proto::terminal< tag::lit_tag >
00022       , proto::unary_expr< tag::not_tag, Literal>
00023       , proto::complement< Literal >
00024       , proto::logical_not< Literal >
00025     > {};
00026 
00027 
00028     struct SAT_Grammar 
00029                 : proto::or_<
00030       proto::_,
00031         Literal
00032       , proto::plus<SAT_Grammar, SAT_Grammar>
00033       , proto::nary_expr<tag::c_tag, proto::vararg<SAT_Grammar> >
00034     > {};
00035 
00036 
00037     /*** SAT expression and Domain ***/ 
00038     template<typename Expr>
00039     struct SAT_Expr;
00040 
00041     struct SAT_Domain
00042     : proto::domain<proto::generator<SAT_Expr>, SAT_Grammar>
00043     {};
00044 
00045     template<typename Expr>
00046       struct SAT_Expr
00047       : proto::extends<Expr, SAT_Expr<Expr>, SAT_Domain >
00048       {
00049         typedef proto::extends<Expr, SAT_Expr<Expr>, SAT_Domain > base_type;
00050 
00051         SAT_Expr(Expr expr ) 
00052           : base_type(expr)
00053         {
00054         }
00055         SAT_Expr( ) 
00056           : base_type(Expr())
00057         {
00058         }
00059       };
00060 
00061 
00062 
00063 
00064      typedef 
00065      proto::result_of::make_expr< proto::tag::terminal, SAT_Domain
00066        , tag::lit_tag
00067      > ::type variable;
00068 
00069      variable new_variable() { 
00070         static unsigned _id = 0;
00071         ++_id;
00072         tag::lit_tag tag;
00073         tag.id = _id;
00074         return proto::make_expr< proto::tag::terminal, SAT_Domain >( tag );
00075      }
00076     
00077      struct clause {
00078      };
00079       
00080    } /* SAT */
00081 } /* metaSMT */
00082 
00083 
00084 // vim: tabstop=2 shiftwidth=2 expandtab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines