Skip to content

format_hook for next_symbol expressions #1209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ebmc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ SRC = \
ebmc_properties.cpp \
ebmc_solver_factory.cpp \
ebmc_version.cpp \
format_hooks.cpp \
instrument_past.cpp \
instrument_buechi.cpp \
k_induction.cpp \
Expand Down
2 changes: 2 additions & 0 deletions src/ebmc/ebmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Author: Daniel Kroening, [email protected]
#include "ebmc_base.h"
#include "ebmc_error.h"
#include "ebmc_version.h"
#include "format_hooks.h"
#include "instrument_buechi.h"
#include "liveness_to_safety.h"
#include "netlist.h"
Expand Down Expand Up @@ -71,6 +72,7 @@ int ebmc_parse_optionst::doit()
}

register_languages();
format_hooks();

if(cmdline.isset("version"))
{
Expand Down
25 changes: 25 additions & 0 deletions src/ebmc/format_hooks.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************\

Module:

Author: Daniel Kroening, [email protected]

\*******************************************************************/

#include "format_hooks.h"

#include <util/format_expr.h>

#include <trans-word-level/next_symbol.h>

void format_hooks()
{
add_format_hook(
ID_next_symbol,
[](std::ostream &os, const exprt &expr) -> std::ostream &
{
const auto &next_symbol_expr = to_next_symbol_expr(expr);
os << "next(" << next_symbol_expr.identifier() << ')';
return os;
});
}
14 changes: 14 additions & 0 deletions src/ebmc/format_hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*******************************************************************\

Module:

Author: Daniel Kroening, [email protected]

\*******************************************************************/

#ifndef EBMC_FORMAT_HOOKS_H
#define EBMC_FORMAT_HOOKS_H

void format_hooks();

#endif // EBMC_FORMAT_HOOKS_H
Loading