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:
Alexandre Duret-Lutz 2010-05-12 19:09:20 +02:00
parent 47b2bea865
commit 126b724a98
33 changed files with 678 additions and 115 deletions

View file

@ -101,7 +101,6 @@ namespace spot
case unop::X:
case unop::F:
case unop::G:
case unop::Star:
case unop::Closure:
case unop::NegClosure:
assert(!"unsupported operator");
@ -110,6 +109,12 @@ namespace spot
assert(0);
}
void
visit(const bunop*)
{
assert(!"unsupported operator");
}
void
visit(const binop* node)
{

View file

@ -141,7 +141,6 @@ namespace spot
succ_ = v.succ_;
return;
case unop::Finish:
case unop::Star:
case unop::Closure:
case unop::NegClosure:
assert(!"unsupported operator");
@ -151,6 +150,12 @@ namespace spot
assert(0);
}
void
visit(const bunop*)
{
assert(!"unsupported operator");
}
void
visit(const binop* node)
{

View file

@ -380,18 +380,34 @@ namespace spot
res_ = !recurse(f) & next_to_concat();
return;
}
case unop::Star:
{
formula* f;
if (to_concat_)
f = multop::instance(multop::Concat, node->clone(),
to_concat_->clone());
else
f = node->clone();
}
/* Unreachable code. */
assert(0);
}
res_ = recurse(node->child(), f) | now_to_concat();
return;
}
void
visit(const bunop* bo)
{
formula* f;
unsigned min = bo->min();
unsigned max = bo->max();
unsigned min2 = (min == 0) ? 0 : (min - 1);
unsigned max2 =
(max == bunop::unbounded) ? bunop::unbounded : (max - 1);
bunop::type op = bo->op();
switch (op)
{
case bunop::Star:
f = bunop::instance(op, bo->child()->clone(), min2, max2);
if (to_concat_)
f = multop::instance(multop::Concat, f, to_concat_->clone());
res_ = recurse(bo->child(), f);
if (min == 0)
res_ |= now_to_concat();
return;
}
/* Unreachable code. */
assert(0);
@ -452,8 +468,8 @@ namespace spot
// | (F_1 | ... | F_n) && (N_1 & ... & N_m);[*]
formula* f = multop::instance(multop::Or, final);
formula* n = multop::instance(multop::AndNLM, non_final);
formula* t = unop::instance(unop::Star,
constant::true_instance());
formula* t = bunop::instance(bunop::Star,
constant::true_instance());
formula* ft = multop::instance(multop::Concat,
f->clone(), t->clone());
formula* nt = multop::instance(multop::Concat,
@ -887,12 +903,15 @@ namespace spot
case unop::Finish:
assert(!"unsupported operator");
break;
case unop::Star:
assert(!"Not an LTL operator");
break;
}
}
void
visit(const bunop*)
{
assert(!"Not an LTL operator");
}
void
visit(const binop* node)
{
@ -1225,6 +1244,12 @@ namespace spot
assert(!"unsupported operator");
}
void
visit(const bunop*)
{
assert(!"unsupported operator");
}
void
visit(const multop* node)
{

View file

@ -150,7 +150,6 @@ namespace spot
return;
}
case unop::Finish:
case unop::Star:
case unop::Closure:
case unop::NegClosure:
assert(!"unsupported operator");
@ -159,6 +158,12 @@ namespace spot
assert(0);
}
void
visit(const bunop*)
{
assert(!"unsupported operator");
}
void
visit(const binop* node)
{