Skip to content
/ lorina Public

C++ parsing library for simple formats used in logic synthesis and formal verification

License

Notifications You must be signed in to change notification settings

hriener/lorina

Repository files navigation

Actions Status Actions Status Actions Status Codacy Badge Coverage Status Documentation Status Latest release License: MIT

lorina

lorina is a C++ parsing library. It provides implementations of parsers for various simple file formats used in logic synthesis and formal verification.

Read the full documentation.

Example

The following code snippet parses the bench file "network.bench" and calls the methods on_input and on_gate for each input and gate declaration in the file, respectively.

#include <lorina/lorina.hpp>

class reader : public bench_reader
{
public:
  void on_input( const std::string& name ) const override
  {
    /* ... */
  }

  void on_gate( const std::vector<std::string>& inputs, const std::string& output,
                const std::string& type ) const override
  {
    /* ... */
  }
}; /* reader */

auto const result = read_bench( "network.bench", reader() );
assert( result == return_code::success );

Besides parsing, the reader supports a mechanism to react on parse errors.

#include <lorina/diagnostics.hpp>

class diagnostics : public diagnostic_consumer
{
public:
  void handle_diagnostic( diagnostic_level level, std::string const& message ) const override
  {
    /* ... */
  }
}; /* diagnostics */

diagnostics consumer;
diagnostic_engine diag( &consumer );
auto const result = read_bench( "network.bench", reader(), &diag );
assert( result == return_code::success );

EPFL logic sythesis libraries

lorina is part of the EPFL logic synthesis libraries. The other libraries and several examples on how to use and integrate the libraries can be found in the logic synthesis tool showcase.

About

C++ parsing library for simple formats used in logic synthesis and formal verification

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages