* HACKING, Makefile.am, configure.ac, m4/gccwarn.m4,
src/Makefile.am, src/ltlast/Makefile.am, src/ltlast/allnodes.hh, src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh, src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/constant.cc, src/ltlast/constant.hh, src/ltlast/formulae.hh, src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/predecl.hh, src/ltlast/unop.cc, src/ltlast/unop.hh, src/ltlast/visitor.hh, src/ltlparse/Makefile.am, src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll, src/ltlparse/parsedecl.hh, src/ltlparse/public.hh, src/ltlvisit/Makefile.am, src/ltlvisit/dotty.cc, src/ltlvisit/dotty.hh, src/ltlvisit/dump.cc, src/ltlvisit/dump.hh, src/ltlvisit/rewrite.cc, src/ltlvisit/rewrite.hh, src/ltltest/Makefile.am, src/ltltest/defs.in, src/ltltest/readltl.cc, src/ltltest/parse.test, src/ltltest/parseerr.test, src/misc/Makefile.am, src/misc/const_sel.hh: New files.
This commit is contained in:
parent
ababb9ff93
commit
f0a8d0aeb3
46 changed files with 1818 additions and 0 deletions
3
src/ltlvisit/.cvsignore
Normal file
3
src/ltlvisit/.cvsignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
9
src/ltlvisit/Makefile.am
Normal file
9
src/ltlvisit/Makefile.am
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
AM_CPPFLAGS = -I$(srcdir)/..
|
||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
||||
|
||||
lib_LIBRARIES = libltlvisit.a
|
||||
libltlvisit_a_SOURCES = \
|
||||
dotty.cc \
|
||||
dotty.hh \
|
||||
dump.cc \
|
||||
dump.hh
|
||||
107
src/ltlvisit/dotty.cc
Normal file
107
src/ltlvisit/dotty.cc
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#include "dotty.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
class dotty_visitor : public spot::ltl::const_visitor
|
||||
{
|
||||
public:
|
||||
dotty_visitor(std::ostream& os = std::cout)
|
||||
: os_(os), label_("i")
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~dotty_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::atomic_prop* ap)
|
||||
{
|
||||
draw_node_(ap->name());
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::constant* c)
|
||||
{
|
||||
draw_node_(c->val_name());
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::binop* bo)
|
||||
{
|
||||
draw_rec_node_(bo->op_name());
|
||||
std::string label = label_;
|
||||
|
||||
label_ += "l";
|
||||
draw_link_(label, label_);
|
||||
bo->first()->accept(*this);
|
||||
label_ = draw_link_(label, label + "r");
|
||||
bo->second()->accept(*this);
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::unop* uo)
|
||||
{
|
||||
draw_rec_node_(uo->op_name());
|
||||
label_ = draw_link_(label_, label_ + "c");
|
||||
uo->child()->accept(*this);
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::multop* mo)
|
||||
{
|
||||
draw_rec_node_(mo->op_name());
|
||||
|
||||
unsigned max = mo->size();
|
||||
std::string label = label_;
|
||||
for (unsigned n = 0; n < max; ++n)
|
||||
{
|
||||
// FIXME: use `n' as a string for label names.
|
||||
label_ = draw_link_(label, label_ + "m");
|
||||
mo->nth(n)->accept(*this);
|
||||
}
|
||||
}
|
||||
private:
|
||||
std::ostream& os_;
|
||||
std::string label_;
|
||||
|
||||
const std::string&
|
||||
draw_link_(const std::string& in, const std::string& out)
|
||||
{
|
||||
os_ << " " << in << " -> " << out << ";" << std::endl;
|
||||
return out;
|
||||
}
|
||||
|
||||
void
|
||||
draw_rec_node_(const char* str) const
|
||||
{
|
||||
os_ << " " << label_ << " [label=\"" << str << "\", shabe=box];"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
draw_node_(const std::string& str) const
|
||||
{
|
||||
os_ << " " << label_ << " [label=\"" << str << "\"];" << std::endl;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void
|
||||
dotty(const formulae& f, std::ostream& os)
|
||||
{
|
||||
dotty_visitor v(os);
|
||||
os << "digraph G {" << std::endl;
|
||||
f.accept(v);
|
||||
os << "}" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
15
src/ltlvisit/dotty.hh
Normal file
15
src/ltlvisit/dotty.hh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef SPOT_LTLVISIT_DOTTY_HH
|
||||
# define SPOT_LTLVISIT_DOTTY_HH
|
||||
|
||||
#include <ltlast/formulae.hh>
|
||||
#include <iostream>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace ltl
|
||||
{
|
||||
void dotty(const formulae& f, std::ostream& os);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_LTLVISIT_DOTTY_HH
|
||||
79
src/ltlvisit/dump.cc
Normal file
79
src/ltlvisit/dump.cc
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#include "dump.hh"
|
||||
#include "ltlast/visitor.hh"
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
class dump_visitor : public spot::ltl::const_visitor
|
||||
{
|
||||
public:
|
||||
dump_visitor(std::ostream& os = std::cout)
|
||||
: os_(os)
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~dump_visitor()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::atomic_prop* ap)
|
||||
{
|
||||
os_ << "AP(" << ap->name() << ")";
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::constant* c)
|
||||
{
|
||||
os_ << "constant(" << c->val_name() << ")";
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::binop* bo)
|
||||
{
|
||||
os_ << "binop(" << bo->op_name() << ", ";
|
||||
bo->first()->accept(*this);
|
||||
os_ << ", ";
|
||||
bo->second()->accept(*this);
|
||||
os_ << ")";
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::unop* uo)
|
||||
{
|
||||
os_ << "unop(" << uo->op_name() << ", ";
|
||||
uo->child()->accept(*this);
|
||||
os_ << ")";
|
||||
}
|
||||
|
||||
void
|
||||
visit(const spot::ltl::multop* mo)
|
||||
{
|
||||
os_ << "multop(" << mo->op_name() << ", ";
|
||||
unsigned max = mo->size();
|
||||
mo->nth(0)->accept(*this);
|
||||
for (unsigned n = 1; n < max; ++n)
|
||||
{
|
||||
std::cout << ", ";
|
||||
mo->nth(n)->accept(*this);
|
||||
}
|
||||
os_ << ")";
|
||||
}
|
||||
private:
|
||||
std::ostream& os_;
|
||||
};
|
||||
|
||||
void
|
||||
dump(const formulae& f, std::ostream& os)
|
||||
{
|
||||
dump_visitor v(os);
|
||||
f.accept(v);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
15
src/ltlvisit/dump.hh
Normal file
15
src/ltlvisit/dump.hh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef SPOT_LTLVISIT_DUMP_HH
|
||||
# define SPOT_LTLVISIT_DUMP_HH
|
||||
|
||||
#include <ltlast/formulae.hh>
|
||||
#include <iostream>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
namespace ltl
|
||||
{
|
||||
void dump(const formulae& f, std::ostream& os);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPOT_LTLVISIT_DUMP_HH
|
||||
Loading…
Add table
Add a link
Reference in a new issue