Start the ELTL translation (LACIM).

Merge all eltlast/ files into formula.hh (except automatop.hh).
This commit is contained in:
Damien Lefortier 2008-06-18 15:11:25 +02:00
parent 862302590c
commit 8c0d1003b0
55 changed files with 2000 additions and 422 deletions

View file

@ -25,20 +25,11 @@ AM_CXXFLAGS = $(WARNING_CXXFLAGS)
eltlastdir = $(pkgincludedir)/eltlast
eltlast_HEADERS = \
allnodes.hh \
atomic_prop.hh \
automatop.hh \
binop.hh \
constant.hh \
formula.hh \
multop.hh \
nfa.hh \
refformula.hh \
unop.hh \
visitor.hh
nfa.hh
noinst_LTLIBRARIES = libeltlast.la
libeltlast_la_SOURCES = \
automatop.cc \
nfa.cc
nfa.cc

View file

@ -1,36 +0,0 @@
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
/// \file eltlast/allnodes.hh
/// \brief Define all ELTL node types.
///
/// This file is usually needed when \b defining a visitor.
#ifndef SPOT_ELTLAST_ALLNODES_HH
# define SPOT_ELTLAST_ALLNODES_HH
# include "binop.hh"
# include "unop.hh"
# include "multop.hh"
# include "atomic_prop.hh"
# include "constant.hh"
# include "automatop.hh"
#endif // SPOT_ELTLAST_ALLNODES_HH

View file

@ -1,42 +0,0 @@
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
/// \file eltlast/atomic_prop.hh
/// \brief ELTL atomic propositions
#ifndef SPOT_ELTLAST_ATOMIC_PROP_HH
# define SPOT_ELTLAST_ATOMIC_PROP_HH
# include "formula.hh"
# include "internal/atomic_prop.hh"
namespace spot
{
namespace eltl
{
/// \brief Atomic propositions.
/// \ingroup eltl_ast
typedef spot::internal::atomic_prop<eltl_t> atomic_prop;
}
}
#endif // SPOT_ELTLAST_ATOMICPROP_HH

View file

@ -19,7 +19,6 @@
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include "visitor.hh"
#include "automatop.hh"
namespace spot

View file

@ -24,14 +24,16 @@
#ifndef SPOT_ELTLAST_AUTOMATOP_HH
# define SPOT_ELTLAST_AUTOMATOP_HH
# include "multop.hh"
# include "refformula.hh"
# include "formula.hh"
# include "nfa.hh"
namespace spot
{
namespace eltl
{
/// \brief Counted-reference formulae.
/// \ingroup eltl_ast
typedef spot::internal::ref_formula<eltl_t> ref_formula;
/// \brief Automaton operators.
/// \ingroup eltl_ast

View file

@ -1,45 +0,0 @@
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
/// \file eltlast/binop.hh
/// \brief ELTL binary operators
///
/// This does not include \c AND and \c OR operators. These are
/// considered to be multi-operand operators (see spot::eltl::multop).
#ifndef SPOT_ELTLAST_BINOP_HH
# define SPOT_ELTLAST_BINOP_HH
# include "formula.hh"
# include "internal/binop.hh"
namespace spot
{
namespace eltl
{
/// \brief Binary operator.
/// \ingroup eltl_ast
typedef spot::internal::binop<eltl_t> binop;
}
}
#endif // SPOT_ELTLAST_BINOP_HH

View file

@ -1,42 +0,0 @@
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
/// \file eltlast/constant.hh
/// \brief ELTL constants
#ifndef SPOT_ELTLAST_CONSTANT_HH
# define SPOT_ELTLAST_CONSTANT_HH
# include "formula.hh"
# include "internal/constant.hh"
namespace spot
{
namespace eltl
{
/// \brief A constant (True or False)
/// \ingroup eltl_ast
typedef spot::internal::constant<eltl_t> constant;
}
}
#endif // SPOT_ELTLAST_CONSTANT_HH

View file

@ -25,6 +25,11 @@
# define SPOT_ELTLAST_FORMULA_HH
# include "internal/formula.hh"
# include "internal/atomic_prop.hh"
# include "internal/constant.hh"
# include "internal/unop.hh"
# include "internal/binop.hh"
# include "internal/multop.hh"
namespace spot
{
@ -40,7 +45,21 @@ namespace spot
/// \addtogroup eltl_ast ELTL Abstract Syntax Tree
/// \ingroup eltl
/// \addtogroup eltl_environment ELTL environments
/// \ingroup eltl
/// ELTL environment implementations.
/// \addtogroup eltl_algorithm Algorithms for ELTL formulae
/// \ingroup eltl
/// \addtogroup eltl_io Input/Output of ELTL formulae
/// \ingroup eltl_algorithm
/// \addtogroup eltl_visitor Derivable visitors
/// \ingroup eltl_algorithm
/// Forward declarations
struct eltl_t;
struct visitor;
struct const_visitor;
@ -50,11 +69,33 @@ namespace spot
///
/// The only way you can work with a formula is to
/// build a spot::eltl::visitor or spot::eltl::const_visitor.
typedef spot::internal::formula<eltl_t> formula;
/// Forward declarations
formula* clone(const formula* f);
std::ostream& to_string(const formula* f, std::ostream& os);
void destroy(const formula* f);
struct eltl_t
{
typedef spot::eltl::visitor visitor;
typedef spot::eltl::const_visitor const_visitor;
static formula* clone_(const formula* f)
{
return clone(f);
}
static std::ostream& to_string_(const formula* f, std::ostream& os)
{
return to_string(f, os);
}
static void destroy_(const formula* f)
{
destroy(f);
}
enum binop { Xor, Implies, Equiv };
const char* binop_name(binop op) const
{
@ -86,10 +127,73 @@ namespace spot
}
};
typedef spot::internal::formula<eltl_t> formula;
typedef spot::internal::formula_ptr_less_than formula_ptr_less_than;
typedef spot::internal::formula_ptr_hash formula_ptr_hash;
/// \brief Atomic propositions.
/// \ingroup eltl_ast
typedef spot::internal::atomic_prop<eltl_t> atomic_prop;
/// \brief A constant (True or False)
/// \ingroup eltl_ast
typedef spot::internal::constant<eltl_t> constant;
/// \brief Unary operators.
/// \ingroup eltl_ast
typedef spot::internal::unop<eltl_t> unop;
/// \brief Binary operator.
/// \ingroup eltl_ast
typedef spot::internal::binop<eltl_t> binop;
/// \brief Multi-operand operators.
/// \ingroup eltl_ast
///
/// These operators are considered commutative and associative.
typedef spot::internal::multop<eltl_t> multop;
// Forward declaration.
struct automatop;
/// \brief Formula visitor that can modify the formula.
/// \ingroup eltl_essential
///
/// Writing visitors is the prefered way
/// to traverse a formula, since it doesn't
/// involve any cast.
///
/// If you do not need to modify the visited formula, inherit from
/// spot::eltl:const_visitor instead.
struct visitor
{
virtual ~visitor() {}
virtual void visit(atomic_prop* node) = 0;
virtual void visit(constant* node) = 0;
virtual void visit(binop* node) = 0;
virtual void visit(unop* node) = 0;
virtual void visit(multop* node) = 0;
virtual void visit(automatop* node) = 0;
};
/// \brief Formula visitor that cannot modify the formula.
///
/// Writing visitors is the prefered way
/// to traverse a formula, since it doesn't
/// involve any cast.
///
/// If you want to modify the visited formula, inherit from
/// spot::eltl:visitor instead.
struct const_visitor
{
virtual ~const_visitor() {}
virtual void visit(const atomic_prop* node) = 0;
virtual void visit(const constant* node) = 0;
virtual void visit(const binop* node) = 0;
virtual void visit(const unop* node) = 0;
virtual void visit(const multop* node) = 0;
virtual void visit(const automatop* node) = 0;
};
typedef spot::internal::formula_ptr_less_than<eltl_t> formula_ptr_less_than;
typedef spot::internal::formula_ptr_hash<eltl_t> formula_ptr_hash;
}
}

View file

@ -1,44 +0,0 @@
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
/// \file eltlast/multop.hh
/// \brief ELTL multi-operand operators
#ifndef SPOT_ELTLAST_MULTOP_HH
# define SPOT_ELTLAST_MULTOP_HH
# include "formula.hh"
# include "internal/multop.hh"
namespace spot
{
namespace eltl
{
/// \brief Multi-operand operators.
/// \ingroup eltl_ast
///
/// These operators are considered commutative and associative.
typedef spot::internal::multop<eltl_t> multop;
}
}
#endif // SPOT_ELTLAST_MULTOP_HH

View file

@ -61,7 +61,7 @@ namespace spot
}
void
nfa::add_transition(const std::string& s, const std::string& d, unsigned c)
nfa::add_transition(const std::string& s, const std::string& d, int c)
{
state* source = add_state(s);
nfa::transition* t = new transition;
@ -90,7 +90,7 @@ namespace spot
return finals_.find(state) != finals_.end();
}
unsigned
int
nfa::arity()
{
return arity_ + 1;

View file

@ -51,7 +51,7 @@ namespace spot
/// Explicit transitions.
struct transition
{
unsigned cost;
int cost;
const state* dest;
};
@ -59,7 +59,7 @@ namespace spot
~nfa();
void
add_transition(const std::string& s, const std::string& d, unsigned c);
add_transition(const std::string& s, const std::string& d, int c);
void
set_init_state(const std::string& state);
@ -72,7 +72,7 @@ namespace spot
is_final(const std::string& state);
/// \brief Get the `arity' i.e. max t.cost, for each transition t.
unsigned
int
arity();
/// \brief Return an iterator on the first succesor (if any) of \a state.
@ -103,7 +103,7 @@ namespace spot
sn_map sn_;
state* init_;
unsigned arity_;
int arity_;
std::set<std::string> finals_;
/// Explicitly disllow use of implicity generated member functions

View file

@ -1,42 +0,0 @@
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
/// \file eltlast/refformula.hh
/// \brief Reference-counted ELTL formulae
#ifndef SPOT_ELTLAST_REFFORMULA_HH
# define SPOT_ELTLAST_REFFORMULA_HH
# include "formula.hh"
# include "internal/refformula.hh"
namespace spot
{
namespace eltl
{
/// \brief A reference-counted ELTL formula.
/// \ingroup eltl_ast
typedef spot::internal::ref_formula<eltl_t> ref_formula;
}
}
#endif // SPOT_ELTLAST_REFFORMULA_HH

View file

@ -1,42 +0,0 @@
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
/// \file eltlast/unop.hh
/// \brief ELTL unary operators
#ifndef SPOT_ELTLAST_UNOP_HH
# define SPOT_ELTLAST_UNOP_HH
# include "formula.hh"
# include "internal/unop.hh"
namespace spot
{
namespace eltl
{
/// \brief Unary operators.
/// \ingroup eltl_ast
typedef spot::internal::unop<eltl_t> unop;
}
}
#endif // SPOT_ELTLAST_UNOP_HH

View file

@ -1,82 +0,0 @@
// Copyright (C) 2008 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
/// \file eltlast/visitor.hh
/// \brief ELTL visitor interface
#ifndef SPOT_ELTLAST_VISITOR_HH
# define SPOT_ELTLAST_VISITOR_HH
# include "binop.hh"
# include "unop.hh"
# include "multop.hh"
# include "atomic_prop.hh"
# include "constant.hh"
namespace spot
{
namespace eltl
{
// Forward declaration.
struct automatop;
/// \brief Formula visitor that can modify the formula.
/// \ingroup eltl_essential
///
/// Writing visitors is the prefered way
/// to traverse a formula, since it doesn't
/// involve any cast.
///
/// If you do not need to modify the visited formula, inherit from
/// spot::eltl:const_visitor instead.
struct visitor
{
virtual ~visitor() {}
virtual void visit(atomic_prop* node) = 0;
virtual void visit(constant* node) = 0;
virtual void visit(binop* node) = 0;
virtual void visit(unop* node) = 0;
virtual void visit(multop* node) = 0;
virtual void visit(automatop* node) = 0;
};
/// \brief Formula visitor that cannot modify the formula.
///
/// Writing visitors is the prefered way
/// to traverse a formula, since it doesn't
/// involve any cast.
///
/// If you want to modify the visited formula, inherit from
/// spot::eltl:visitor instead.
struct const_visitor
{
virtual ~const_visitor() {}
virtual void visit(const atomic_prop* node) = 0;
virtual void visit(const constant* node) = 0;
virtual void visit(const binop* node) = 0;
virtual void visit(const unop* node) = 0;
virtual void visit(const multop* node) = 0;
virtual void visit(const automatop* node) = 0;
};
}
}
#endif // SPOT_ELTLAST_VISITOR_HH