org: simplify babel blocks using #+PROPERTY: header-args
This feature is in Org 9, which is already required. * doc/org/autcross.org, doc/org/autfilt.org, doc/org/compile.org, doc/org/concepts.org, doc/org/csv.org, doc/org/dstar2tgba.org, doc/org/genaut.org, doc/org/genltl.org, doc/org/hierarchy.org, doc/org/hoa.org, doc/org/ioltl.org, doc/org/ltl2tgba.org, doc/org/ltl2tgta.org, doc/org/ltlcross.org, doc/org/ltldo.org, doc/org/ltlfilt.org, doc/org/ltlgrind.org, doc/org/ltlsynt.org, doc/org/oaut.org, doc/org/randaut.org, doc/org/randltl.org, doc/org/satmin.org, doc/org/setup.org, doc/org/tools.org, doc/org/tut01.org, doc/org/tut02.org, doc/org/tut03.org, doc/org/tut04.org, doc/org/tut10.org, doc/org/tut11.org, doc/org/tut12.org, doc/org/tut20.org, doc/org/tut21.org, doc/org/tut22.org, doc/org/tut23.org, doc/org/tut24.org, doc/org/tut30.org, doc/org/tut31.org, doc/org/tut50.org, doc/org/upgrade2.org: Simplify SRC block setups for sh, python and C++. Also fix a few typos and examples along the way.
This commit is contained in:
parent
0c8e6a38a8
commit
8a96828d85
40 changed files with 2193 additions and 2281 deletions
|
|
@ -3,6 +3,9 @@
|
|||
#+DESCRIPTION: Code example for parsing and printing formulas in Spot
|
||||
#+INCLUDE: setup.org
|
||||
#+HTML_LINK_UP: tut.html
|
||||
#+PROPERTY: header-args:sh :results verbatim :exports both
|
||||
#+PROPERTY: header-args:python :results output :exports both
|
||||
#+PROPERTY: header-args:C+++ :results verbatim :exports both
|
||||
|
||||
Our first task is to read formulas and print them in another syntax.
|
||||
|
||||
|
|
@ -15,7 +18,7 @@ of LBT, you should use [[file:ioltl.org][=--lbt-input=]]. The output syntax is
|
|||
using different options such as (=--spin=, =--lbt=, =--latex=, etc.).
|
||||
Full parentheses can also be requested using =-p=.
|
||||
|
||||
#+BEGIN_SRC sh :results verbatim :exports both
|
||||
#+BEGIN_SRC sh
|
||||
ltlfilt -f '[]<>p0 || <>[]p1'
|
||||
formula='& & G p0 p1 p2'
|
||||
ltlfilt --lbt-input -f "$formula" --latex
|
||||
|
|
@ -39,7 +42,7 @@ other syntaxes.)
|
|||
|
||||
Here are the same operations in Python
|
||||
|
||||
#+BEGIN_SRC python :results output :exports both
|
||||
#+BEGIN_SRC python
|
||||
import spot
|
||||
print(spot.formula('[]<>p0 || <>[]p1'))
|
||||
f = spot.formula('& & G p0 p1 p2')
|
||||
|
|
@ -70,7 +73,7 @@ above in the python bindings. Here parse errors would be returned as
|
|||
exceptions.
|
||||
|
||||
#+NAME: 1stex
|
||||
#+BEGIN_SRC C++ :results verbatim :exports both
|
||||
#+BEGIN_SRC C++
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
#include <spot/tl/print.hh>
|
||||
|
|
@ -113,7 +116,7 @@ parser. Additionally, this give you control over how to print errors.
|
|||
|
||||
Here is how to call the infix parser explicitly:
|
||||
|
||||
#+BEGIN_SRC C++ :results verbatim :exports both
|
||||
#+BEGIN_SRC C++
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
|
|
@ -157,7 +160,7 @@ about the extra parenthesis, but it will still return a formula that
|
|||
is equivalent to =a U b=. You could decide to continue with the
|
||||
"fixed" formula if you wish. Here is an example:
|
||||
|
||||
#+BEGIN_SRC C++ :results verbatim :exports both
|
||||
#+BEGIN_SRC C++
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
|
|
@ -197,7 +200,7 @@ really cannot recover anything.
|
|||
The only difference here is the call to =parse_prefix_ltl()= instead
|
||||
of =parse_infix_psl()=.
|
||||
|
||||
#+BEGIN_SRC C++ :results verbatim :exports both
|
||||
#+BEGIN_SRC C++
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
|
|
@ -241,7 +244,7 @@ down the line.
|
|||
For instance, let's see what happens if a PSL formulas is passed to
|
||||
=print_spin_ltl=:
|
||||
|
||||
#+BEGIN_SRC C++ :results verbatim :exports both
|
||||
#+BEGIN_SRC C++
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
|
|
@ -270,7 +273,7 @@ If that is unwanted, here are two possible solutions.
|
|||
|
||||
The first is to simply diagnose non-LTL formulas.
|
||||
|
||||
#+BEGIN_SRC C++ :results verbatim :exports code
|
||||
#+BEGIN_SRC C++ :exports code
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
|
|
@ -299,7 +302,7 @@ equivalent LTL formula. This does not always work, so you need to be
|
|||
prepared to reject the formula anyway. In our example, we are lucky
|
||||
(maybe because it was carefully chosen...):
|
||||
|
||||
#+BEGIN_SRC C++ :results verbatim :exports both
|
||||
#+BEGIN_SRC C++
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <spot/tl/parse.hh>
|
||||
|
|
@ -342,7 +345,7 @@ syntax for atomic propositions supported by any tool. The usual
|
|||
workaround in Spot is to double-quote any arbitrary atomic
|
||||
proposition:
|
||||
|
||||
#+BEGIN_SRC sh :results verbatim :exports both
|
||||
#+BEGIN_SRC sh
|
||||
echo compare
|
||||
ltlfilt -f '"a > 4" U "b < 5"'
|
||||
echo and
|
||||
|
|
@ -363,7 +366,7 @@ it has an option for that. This is called /lenient parsing/: when the
|
|||
parser finds a parenthetical block it does not understand, it simply
|
||||
assume that this block represents an atomic proposition.
|
||||
|
||||
#+BEGIN_SRC sh :results verbatim :exports both
|
||||
#+BEGIN_SRC sh
|
||||
ltlfilt --lenient -f '(a > 4) U (b < 5)'
|
||||
#+END_SRC
|
||||
|
||||
|
|
@ -373,7 +376,7 @@ ltlfilt --lenient -f '(a > 4) U (b < 5)'
|
|||
Lenient parsing is risky, because any parenthesized sub-formula that
|
||||
is a syntax-error will be treated as an atomic proposition:
|
||||
|
||||
#+BEGIN_SRC sh :results verbatim :exports both
|
||||
#+BEGIN_SRC sh
|
||||
ltlfilt --lenient -f '(a U ) U c'
|
||||
#+END_SRC
|
||||
|
||||
|
|
@ -388,7 +391,7 @@ Formulas have a custom format specification language that allows you
|
|||
to easily change the way a formula should be output when using the
|
||||
=format()= method of strings.
|
||||
|
||||
#+BEGIN_SRC python :results output :exports both
|
||||
#+BEGIN_SRC python
|
||||
import spot
|
||||
formula = spot.formula('a U b U "$strange[0]=name"')
|
||||
print("""\
|
||||
|
|
@ -418,7 +421,7 @@ produced from the formula.
|
|||
The complete list of specifier that apply to formulas can always be
|
||||
printed with =help(spot.formula.__format__)=:
|
||||
|
||||
#+BEGIN_SRC python :results output :exports results
|
||||
#+BEGIN_SRC python :exports results
|
||||
import spot
|
||||
help(spot.formula.__format__)
|
||||
#+END_SRC
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue