Add support the bounded star operator [*i..j].
* src/ltlast/bunop.hh, src/ltlast/bunop.cc: New files for bounded unary operators. * src/ltlast/Makefile.am, src/ltlast/allnodes.hh: Add them. * src/ltlast/predecl.hh (bunop): Declare. * src/ltlast/unop.hh, src/ltlast/unop.cc (Star): Remove declaration of Star and associated code. * src/ltlast/visitor.hh: Add visit(bunop* node) methods. * src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll: Add parse rules for LTL. This required passing the parse_error list to the lexer, so it can report scanning errors when it reads a number that does not fit in an unsigned int. * src/ltlparse/parsedecl.hh (YY_DECL): Take error_list as third argument. * src/ltltest/consterm.test, src/ltltest/tostring.test, src/ltltest/equals.test, src/tgbatest/ltl2tgba.test: More tests. * src/ltlvisit/basicreduce.cc, src/ltlvisit/clone.cc, src/ltlvisit/clone.hh, src/ltlvisit/consterm.cc, src/ltlvisit/dotty.cc, src/ltlvisit/mark.cc, src/ltlvisit/nenoform.cc, src/ltlvisit/postfix.cc, src/ltlvisit/postfix.hh, src/ltlvisit/reduce.cc, src/ltlvisit/syntimpl.cc, src/ltlvisit/tostring.cc, src/ltlvisit/tunabbrev.cc, src/tgba/formula2bdd.cc, src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2tgba_lacim.cc: Adjust syntax to use "bunop::Star" instead of "unop::Star". * src/tgbaalgos/ltl2tgba_fm.cc: Likewise, but also adjust the code to handle the bounds of the operator.
This commit is contained in:
parent
47b2bea865
commit
126b724a98
33 changed files with 678 additions and 115 deletions
|
|
@ -75,8 +75,13 @@ namespace spot
|
|||
void
|
||||
visit(atomic_prop* ap)
|
||||
{
|
||||
formula* f = ap->clone();
|
||||
result_ = f;
|
||||
result_ = ap->clone();
|
||||
}
|
||||
|
||||
void
|
||||
visit(bunop* bo)
|
||||
{
|
||||
result_ = bo->clone();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -239,7 +244,6 @@ namespace spot
|
|||
return;
|
||||
|
||||
case unop::Finish:
|
||||
case unop::Star:
|
||||
case unop::Closure:
|
||||
case unop::NegClosure:
|
||||
result_ = unop::instance(uo->op(), result_);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2009 Laboratoire de Recherche et Développement
|
||||
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -54,6 +54,13 @@ namespace spot
|
|||
result_ = c->clone();
|
||||
}
|
||||
|
||||
void
|
||||
clone_visitor::visit(bunop* bo)
|
||||
{
|
||||
result_ = bunop::instance(bo->op(), recurse(bo->child()),
|
||||
bo->min(), bo->max());
|
||||
}
|
||||
|
||||
void
|
||||
clone_visitor::visit(unop* uo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2009 Laboratoire de Recherche et Développement
|
||||
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
|
|
@ -52,6 +52,7 @@ namespace spot
|
|||
void visit(automatop* mo);
|
||||
void visit(multop* mo);
|
||||
void visit(constant* c);
|
||||
void visit(bunop* c);
|
||||
|
||||
virtual formula* recurse(formula* f);
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,15 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
visit(const bunop* bo)
|
||||
{
|
||||
if (bo->min() == 0)
|
||||
result_ = true;
|
||||
else
|
||||
bo->child()->accept(*this);
|
||||
}
|
||||
|
||||
void
|
||||
visit(const unop* uo)
|
||||
{
|
||||
|
|
@ -78,9 +87,6 @@ namespace spot
|
|||
case unop::Not:
|
||||
result_ = false;
|
||||
break;
|
||||
case unop::Star:
|
||||
result_ = true;
|
||||
break;
|
||||
case unop::X:
|
||||
case unop::F:
|
||||
case unop::G:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (C) 2011 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
// 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.
|
||||
|
|
@ -60,6 +60,16 @@ namespace spot
|
|||
draw_node_(c, c->val_name(), true);
|
||||
}
|
||||
|
||||
void
|
||||
visit(const bunop* so)
|
||||
{
|
||||
if (draw_node_(so, so->format(), true))
|
||||
{
|
||||
dir = none;
|
||||
so->child()->accept(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
visit(const binop* bo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,6 +58,11 @@ namespace spot
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
visit(bunop*)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
visit(unop* uo)
|
||||
{
|
||||
|
|
@ -67,7 +72,6 @@ namespace spot
|
|||
result_ = true;
|
||||
return;
|
||||
case unop::Finish:
|
||||
case unop::Star:
|
||||
case unop::Closure:
|
||||
case unop::Not:
|
||||
case unop::X:
|
||||
|
|
@ -161,6 +165,12 @@ namespace spot
|
|||
result_ = c->clone();
|
||||
}
|
||||
|
||||
void
|
||||
visit(bunop* bo)
|
||||
{
|
||||
result_ = bo->clone();
|
||||
}
|
||||
|
||||
void
|
||||
visit(unop* uo)
|
||||
{
|
||||
|
|
@ -170,7 +180,6 @@ namespace spot
|
|||
has_mark_ = true;
|
||||
/* fall through */
|
||||
case unop::Finish:
|
||||
case unop::Star:
|
||||
case unop::Closure:
|
||||
case unop::Not:
|
||||
case unop::X:
|
||||
|
|
@ -322,6 +331,12 @@ namespace spot
|
|||
result_ = c->clone();
|
||||
}
|
||||
|
||||
void
|
||||
visit(bunop* bo)
|
||||
{
|
||||
result_ = bo->clone();
|
||||
}
|
||||
|
||||
void
|
||||
visit(unop* uo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -119,9 +119,7 @@ namespace spot
|
|||
recurse_(f, false));
|
||||
return;
|
||||
/* !Finish(x), is not simplified */
|
||||
/* !(a*) is not simplified */
|
||||
case unop::Finish:
|
||||
case unop::Star:
|
||||
result_ = unop::instance(uo->op(), recurse_(f, false));
|
||||
if (negated_)
|
||||
result_ = unop::instance(unop::Not, result_);
|
||||
|
|
@ -131,6 +129,16 @@ namespace spot
|
|||
assert(0);
|
||||
}
|
||||
|
||||
void
|
||||
visit(bunop* bo)
|
||||
{
|
||||
// !(a*) is not simplified
|
||||
result_ = bunop::instance(bo->op(), recurse_(bo->child(), false),
|
||||
bo->min(), bo->max());
|
||||
if (negated_)
|
||||
result_ = unop::instance(unop::Not, result_);
|
||||
}
|
||||
|
||||
void
|
||||
visit(binop* bo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
|
|
@ -73,6 +75,12 @@ namespace spot
|
|||
doit(mo);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::visit(bunop* so)
|
||||
{
|
||||
doit(so);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::visit(constant* c)
|
||||
{
|
||||
|
|
@ -109,6 +117,12 @@ namespace spot
|
|||
doit_default(ao);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::doit(bunop* so)
|
||||
{
|
||||
doit_default(so);
|
||||
}
|
||||
|
||||
void
|
||||
postfix_visitor::doit(constant* c)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
|
||||
// de l'Epita (LRDE).
|
||||
// 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.
|
||||
|
|
@ -47,6 +49,7 @@ namespace spot
|
|||
void visit(multop* mo);
|
||||
void visit(automatop* c);
|
||||
void visit(constant* c);
|
||||
void visit(bunop* c);
|
||||
|
||||
virtual void doit(atomic_prop* ap);
|
||||
virtual void doit(unop* uo);
|
||||
|
|
@ -54,6 +57,7 @@ namespace spot
|
|||
virtual void doit(multop* mo);
|
||||
virtual void doit(automatop* mo);
|
||||
virtual void doit(constant* c);
|
||||
virtual void doit(bunop* c);
|
||||
virtual void doit_default(formula* f);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,12 @@ namespace spot
|
|||
ret_.v = 0;
|
||||
}
|
||||
|
||||
void
|
||||
visit(const bunop*)
|
||||
{
|
||||
ret_.v = 0;
|
||||
}
|
||||
|
||||
void
|
||||
visit(const unop* uo)
|
||||
{
|
||||
|
|
@ -228,6 +234,13 @@ namespace spot
|
|||
result_ = c;
|
||||
}
|
||||
|
||||
void
|
||||
visit(bunop* bo)
|
||||
{
|
||||
result_ = bunop::instance(bo->op(), recurse(bo->child()),
|
||||
bo->min(), bo->max());
|
||||
}
|
||||
|
||||
void
|
||||
visit(unop* uo)
|
||||
{
|
||||
|
|
@ -252,7 +265,6 @@ namespace spot
|
|||
case unop::Not:
|
||||
case unop::X:
|
||||
case unop::Finish:
|
||||
case unop::Star:
|
||||
case unop::Closure:
|
||||
case unop::NegClosure:
|
||||
result_ = unop::instance(uo->op(), result_);
|
||||
|
|
|
|||
|
|
@ -79,6 +79,11 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
visit(const bunop*)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
visit(const unop* uo)
|
||||
{
|
||||
|
|
@ -106,7 +111,6 @@ namespace spot
|
|||
result_ = true;
|
||||
return;
|
||||
case unop::Finish:
|
||||
case unop::Star:
|
||||
case unop::Closure:
|
||||
case unop::NegClosure:
|
||||
return;
|
||||
|
|
@ -265,6 +269,11 @@ namespace spot
|
|||
result_ = v.result();
|
||||
}
|
||||
|
||||
void
|
||||
visit(const bunop*)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
visit(const constant* c)
|
||||
{
|
||||
|
|
@ -339,7 +348,6 @@ namespace spot
|
|||
return;
|
||||
}
|
||||
case unop::Finish:
|
||||
case unop::Star:
|
||||
case unop::Closure:
|
||||
case unop::NegClosure:
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -179,6 +179,31 @@ namespace spot
|
|||
closep();
|
||||
}
|
||||
|
||||
void
|
||||
visit(const bunop* bo)
|
||||
{
|
||||
// Abbreviate "1*" as "*".
|
||||
if (bo->child() != constant::true_instance())
|
||||
{
|
||||
// a* is OK, no need to print {a}*.
|
||||
// However want braces for {!a}*, the only unary
|
||||
// operator that can be nested with *.
|
||||
bool need_parent = !!dynamic_cast<const unop*>(bo->child());
|
||||
|
||||
if (need_parent || full_parent_)
|
||||
openp();
|
||||
bo->child()->accept(*this);
|
||||
if (need_parent || full_parent_)
|
||||
closep();
|
||||
}
|
||||
|
||||
// Output "*" instead of "[*]".
|
||||
if (bo->min() == 0 && bo->max() == bunop::unbounded)
|
||||
os_ << "*";
|
||||
else
|
||||
os_ << bo->format();
|
||||
}
|
||||
|
||||
void
|
||||
visit(const unop* uo)
|
||||
{
|
||||
|
|
@ -225,19 +250,6 @@ namespace spot
|
|||
in_ratexp_ = true;
|
||||
top_level_ = true;
|
||||
break;
|
||||
case unop::Star:
|
||||
// Abbreviate "1*" as "*".
|
||||
if (uo->child() == constant::true_instance())
|
||||
{
|
||||
os_ << "*";
|
||||
return;
|
||||
}
|
||||
// 1* is OK, no need to print {1}*.
|
||||
// However want braces for {!a}*, the only unary
|
||||
// operator that can be nested with *.
|
||||
need_parent = !!dynamic_cast<const unop*>(uo->child());
|
||||
// Do not output anything yet, star is a postfix operator.
|
||||
break;
|
||||
}
|
||||
|
||||
top_level_ = false;
|
||||
|
|
@ -249,9 +261,6 @@ namespace spot
|
|||
|
||||
switch (uo->op())
|
||||
{
|
||||
case unop::Star:
|
||||
os_ << "*";
|
||||
break;
|
||||
case unop::Closure:
|
||||
case unop::NegClosure:
|
||||
os_ << "}";
|
||||
|
|
@ -476,19 +485,6 @@ namespace spot
|
|||
top_level_ = true;
|
||||
in_ratexp_ = true;
|
||||
break;
|
||||
case unop::Star:
|
||||
// Abbreviate "1*" as "*".
|
||||
if (uo->child() == constant::true_instance())
|
||||
{
|
||||
os_ << "*";
|
||||
return;
|
||||
}
|
||||
// 1* is OK, no need to print {1}*.
|
||||
// However want braces for {!a}*, the only unary
|
||||
// operator that can be nested with *.
|
||||
need_parent = !!dynamic_cast<const unop*>(uo->child());
|
||||
// Do not output anything yet, star is a postfix operator.
|
||||
break;
|
||||
}
|
||||
|
||||
if (need_parent)
|
||||
|
|
@ -499,9 +495,6 @@ namespace spot
|
|||
|
||||
switch (uo->op())
|
||||
{
|
||||
case unop::Star:
|
||||
os_ << "*";
|
||||
break;
|
||||
case unop::Closure:
|
||||
case unop::NegClosure:
|
||||
os_ << "}";
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ namespace spot
|
|||
case unop::Finish:
|
||||
case unop::X:
|
||||
case unop::Not:
|
||||
case unop::Star:
|
||||
case unop::Closure:
|
||||
case unop::NegClosure:
|
||||
this->super::visit(uo);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue