You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

243 lines
7.8 KiB

2 months ago
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  5. <link href="cpphoafparser.css" rel="stylesheet">
  6. <title>The cpphoaf command-line tool [cpphoafparser Library for the Hanoi Omega-Automata Format (HOAF), version 0.99.2]</title>
  7. </head>
  8. <body>
  9. <div class="nav"><a class="nav" href="index.html">^ Overview</a></div>
  10. <h1>
  11. The <span class="blue1">cpp</span><span class="blue2">hoaf</span> Command-Line Tool<br/>
  12. <span style="font-size:70%">The <span class="blue">cpphoafparser</span>
  13. Library for the Hanoi Omega-Automata Format (HOAF), version 0.99.2</span>
  14. </h1>
  15. <p>
  16. The cpphoafparser library provides a command-line interface to some of
  17. the functionality. This can be roughly divided into two broad areas:
  18. </p>
  19. <ul>
  20. <li><em>Validating</em> an automaton (no syntax errors, declared properties are correct, ...)</li>
  21. <li><em>Transforming</em> an automaton (translating from state- to transition-based acceptance, ...)</li>
  22. </ul>
  23. <p>We assume here that the reader is familiar with the basic concepts of
  24. the <a href="http://adl.github.io/hoaf/">Hanoi Omega-Automata Format (HOAF)</a>.
  25. </p>
  26. <h2><a name="general">General</a></h2>
  27. <h3>Obtaining and invoking the command-line tool</h3>
  28. We assume here that you have downloaded the source code archive
  29. from the <a href="http://automata.tools/hoa/cpphoafparser/">website</a>.
  30. Unpack and build (Linux, OS X, ...):
  31. <pre class="command">
  32. tar xzvf cpphoafparser-xx.yy.tgz
  33. cd cpphoafparser-xx.yy
  34. make
  35. </pre>
  36. <p>
  37. where <i>xx.yy</i> is the version.</p>
  38. <p>Alternatively, for Windows, you can download a precompiled binary.</p>
  39. <p>There is also a <span class="classname">CMakeLists.txt</span>
  40. configuration for <a href="http://www.cmake.org/">CMake</a> available. In the top-level directory, execute:
  41. <pre class="command">
  42. mkdir build
  43. cd build
  44. cmake ../src
  45. make
  46. </pre>
  47. <p>CMake can alse be used to generate Visual Studio project files.</p>
  48. <h3>Getting Help</h3>
  49. <p>With</p>
  50. <pre class="command">
  51. ./cpphoaf help
  52. </pre>
  53. <p>you'll obtain a brief description of the supported commands and
  54. flags.</p>
  55. <h3>Input / Output</h3>
  56. <p>
  57. The command-line tool reads the file specified on the command-line, performs the required
  58. processing and outputs the result to the standard output.
  59. The hyphen character '-' can be used instead of the filename for reading from standard input.
  60. Below, we provide some examples of invoking the command-line tool:
  61. </p>
  62. <p>
  63. In the simplest case, the following command parses the automaton
  64. from automaton.hoa and prints the result
  65. (the parsed automaton without comments, extra whitespace, etc) to the
  66. console:
  67. </p>
  68. <pre class="command">
  69. ./cpphoaf print automaton.hoa
  70. </pre>
  71. <p>
  72. In the next example, we pipe the output of some other tool to the
  73. input of cpphoaf:
  74. </p>
  75. <pre class="command">
  76. ./some-hoa-producer | ./cpphoaf print -
  77. </pre>
  78. <p>
  79. The output can be captured as usual to a file using redirection:
  80. </p>
  81. <pre class="command">
  82. ./some-hoa-producer | ./cpphoaf print - > result.hoa
  83. </pre>
  84. <p>
  85. Note: Take care that you do not simultaneously read and write from/to the same file!
  86. </p>
  87. <h3>Commands and Flags</h3>
  88. <p>
  89. The general structure of invoking the command line-tool is
  90. </p>
  91. <pre class="command">
  92. ./cpphoaf command flag(s) file(s)
  93. </pre>
  94. <h3>Multiple automata</h3>
  95. <p>
  96. The HOA format supports the streaming of automata, i.e., the ability to represent a
  97. sequence of automata in a single file.
  98. </p>
  99. <p>
  100. Please note that, currently, the <span class="prog">cpphoaf</span> tool only supports parsing
  101. a single automaton.
  102. </p>
  103. <h3>Exit value</h3>
  104. <p>
  105. If you want to use the command-line tool in scripts, the value returned by the tool on exit
  106. is useful for diagnosing errors. The tool will return 0 for success/no errors. If there are
  107. errors during the processing of the automata, the value 1 will be returned. If there are problems
  108. with the invocation (invalid command-line arguments, ...), the value 2
  109. will be returned.
  110. </p>
  111. <h2><a name="validating">Validating Automata</a></h2>
  112. <p>To check that an automaton in HOA format can be successfully parsed, run
  113. </p>
  114. <pre class="commandWithOutput">
  115. ./cpphoaf parse automaton-file.hoa
  116. </pre>
  117. <pre class="output">
  118. Parsing OK
  119. </pre>
  120. <p>If everything went fine, the tool will output that parsing was OK,
  121. otherwise there will be an error message indicating what went wrong.</p>
  122. <p>Upon success, the automaton</p>
  123. <ul>
  124. <li>has been successfully parsed (syntax conforms to the HOA
  125. format),</li>
  126. <li>properties specified in the header have been verified to be
  127. correct (violations of <em>state-labels</em>, <em>trans-labels</em>,
  128. <em>implicit-labels</em>, <em>explicit-labels</em>, <em>state-acc</em>,
  129. <em>trans-acc</em>, <em>no-univ-branch</em>, <em>colored</em> are currently detected;
  130. for the <em>deterministic</em> and <em>complete</em> properties, violations are
  131. currently only detected when implicit transition labels are used),
  132. </li>
  133. <li>if an <em>acc-name</em> header has been provided and is one
  134. of the standard acceptance conditions specified in the format, the
  135. correspondence with the <em>Acceptance</em> header has been verified
  136. </li>
  137. <li>the number, ordering and names of the states are valid with regard to
  138. the restrictions specified in the HOA format,
  139. </li>
  140. <li>if implicit transition labels are used, the required number is present,
  141. </li>
  142. <li>alias definitions are non-recursive and all aliases, atomic propositions and
  143. acceptance sets that are used are defined.
  144. </li>
  145. </ul>
  146. <p>
  147. The semantic validations can be disabled by the command-line
  148. option <span class="cmdline">--no-validate</span>. The following command
  149. will only check the syntactic correctness according to the HOA format:
  150. </p>
  151. <pre class="command">
  152. ./cpphoaf parse --no-validate automaton.hoa
  153. </pre>
  154. <h2>Transforming the Automaton</h2>
  155. <h3>Pretty-printing the Automaton</h3>
  156. <p>The simplest transformation is barely a transformation at all. Via</p>
  157. <pre class="command">
  158. ./cpphoaf print automaton-file.hoa
  159. </pre>
  160. <p>the automaton is simply parsed and printed back to the standard output.</p>
  161. <p>
  162. As comments and superfluous whitespace are ignored by the parser, this transforms the
  163. automaton into some kind of canonical form, with the different elements of the HOA format
  164. each placed on a single line.
  165. </p>
  166. <h3>Resolving Aliases</h3>
  167. <p>
  168. The command-line option <span class="cmdline">--resolve-aliases</span> activates a transformation
  169. that (1) removes the <em>Alias:</em> <a class="explanationref" href="http://adl.github.io/hoaf/#alias" target="_blank">?</a>
  170. definitions and (2) resolves all <em>@alias</em> references in
  171. transition labels.</p>
  172. <p>The following command reads the automaton, resolves the aliases and prints the resulting automaton:</p>
  173. <pre class="command">
  174. ./cpphoaf print --resolve-aliases automaton-file.hoa
  175. </pre>
  176. <p>
  177. The option <span class="cmdline">--resolve-aliases</span>
  178. can be used with all other commands and options.
  179. </p>
  180. <h2>Tracing, Implementation Details</h2>
  181. <p>If you wish to implement your own transformations or want to use the cpphoafparser library,
  182. it might be interesting to play around with the <span class="cmdline">--trace</span> option:</p>
  183. <pre class="command">
  184. ./cpphoaf parse --trace automaton-file.hoa
  185. </pre>
  186. <p>
  187. If activated, tracing will output the sequence of method calls into
  188. the <em>HOAConsumer</em> by
  189. the parser. This can be used to study the correspondence of syntactical elements in the
  190. HOA format and the method calls.
  191. </p>
  192. <p>
  193. The command-line utility is implemented in the
  194. <span class="classname">src/cpphoaf.cc</span>. It relies on the various
  195. <em>HOAConsumers</em> for the functionality and is a good entry-point for further investigations.
  196. </p>
  197. <hr>
  198. <p>If you have further questions, find bugs or want to tell
  199. us about your use of the cpphoafparser library, please feel free to contact us!</p>
  200. <p>(c) 2015-2016
  201. Joachim Klein &lt;klein&#064;tcs.inf.tu-dresden.de&gt;,
  202. David M&uuml;ller &lt;david.mueller&#064;tcs.inf.tu-dresden.de&gt;
  203. </body>
  204. </html>