ltlparse: add a lenient parsing mode
Spin 6 supports formulas such as []<>(a < b) so that atomic properties
need not be specified using #define. Of course we don't want to
implement all the syntax of Spin in our LTL parser because other tools
may have different syntaxes for their atomic propositions. The
lenient mode tells the scanner to return any (...), {...}, or {...}!
block as a single token. The parser will try to recursively parse
this block as a LTL/SERE formula, and if this fails, it will consider
the block to be an atomic proposition. The drawback is that most
syntax errors will no be considered to be atomic propositions. For
instance (a U b U) is a single atomic proposition in lenient mode, and
a syntax error in default mode.
* src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll,
src/ltlparse/parsedecl.hh, src/ltlparse/public.hh: Add a
lenient parsing mode. Simplify the lexer using yy_scan_string.
* src/bin/common_finput.cc: Add a --lenient option.
* src/ltltest/lenient.test: New file.
* src/ltltest/Makefile.am: Add it.
* src/neverparse/neverclaimparse.yy: Parse the guards in lenient mode.
* src/tgbatest/neverclaimread.test: Adjust.
* src/ltlvisit/tostring.cc: When outputing a formula in Spin's syntax,
output (a < b) instead of "a < b".
* src/misc/escape.cc, src/misc/escape.hh (trim): New helper function.
This commit is contained in:
parent
d9ceb4adc4
commit
86dac4aadf
12 changed files with 355 additions and 60 deletions
|
|
@ -85,6 +85,7 @@ TESTS = \
|
|||
tunenoform.test \
|
||||
consterm.test \
|
||||
kind.test \
|
||||
lenient.test \
|
||||
syntimpl.test \
|
||||
reduc.test \
|
||||
reducpsl.test \
|
||||
|
|
|
|||
50
src/ltltest/lenient.test
Executable file
50
src/ltltest/lenient.test
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2012 Laboratoire de Recherche et Développement de
|
||||
# l'Epita (LRDE).
|
||||
#
|
||||
# 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
. ./defs || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
ltlfilt=../../bin/ltlfilt
|
||||
|
||||
cat >input <<EOF
|
||||
(a < b) U (b == c - 1)
|
||||
((a < b) U {b == c - 1})
|
||||
(((a < b) U (b == c - 1)))
|
||||
(((((a < b))) U (b == c - 1)))
|
||||
(((a < b) U (((b == c - 1)))))
|
||||
(((a < b ) U ({( b == c - 1 )})))
|
||||
((((( a < b))) U ( b == c - 1)))
|
||||
((((( a < b))) U { b == c - 1}!))
|
||||
EOF
|
||||
|
||||
cat >expected <<EOF
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
"a < b" U "b == c - 1"
|
||||
EOF
|
||||
|
||||
run 0 $ltlfilt --lenient input > output
|
||||
cmp output expected
|
||||
Loading…
Add table
Add a link
Reference in a new issue