BENCH parser

The header <lorina/bench.hpp> implements methods to parse the BENCH format.

The class lorina::bench_reader provides the following public member functions.

Function Description
on_input(name) Callback method for parsed input
on_output(name) Callback method for parsed output
on_gate(inputs, output, type) Callback method for parsed gate
on_assign(input, output) Callback method for parsed gate assignment

The following reader functions are available.

Function
Description
read_bench
Reader function for the BENCH format.
read_bench
Reader function for BENCH format.
return_code lorina::read_bench(std::istream &in, const bench_reader &reader, diagnostic_engine *diag = nullptr)

Reader function for the BENCH format.

Reads BENCH format from a stream and invokes a callback method for each parsed primitive and each detected parse error.

Return
Success if parsing have been successful, or parse error if parsing have failed
Parameters
  • in: Input stream
  • reader: A BENCH reader with callback methods invoked for parsed primitives
  • diag: An optional diagnostic engine with callback methods for parse errors

return_code lorina::read_bench(const std::string &filename, const bench_reader &reader, diagnostic_engine *diag = nullptr)

Reader function for BENCH format.

Reads BENCH format from a file and invokes a callback method for each parsed primitive and each detected parse error.

Return
Success if parsing have been successful, or parse error if parsing have failed
Parameters
  • filename: Name of the file
  • reader: A BENCH reader with callback methods invoked for parsed primitives
  • diag: An optional diagnostic engine with callback methods for parse errors