Skip to content
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

Exposing application parameters #238

Open
dp1 opened this issue May 2, 2023 · 1 comment
Open

Exposing application parameters #238

dp1 opened this issue May 2, 2023 · 1 comment

Comments

@dp1
Copy link
Contributor

dp1 commented May 2, 2023

It would be useful to expose application parameters, such as the high and low limits of a Z3_OP_EXTRACT.
The python bindings expose them with a params() method on FuncDeclRef, which may be a good way here as well.

For my specific application I only need access to integer parameters (for extract, zero and sign extend), but it makes sense to think of the other parameter types too. I may have time to work on this, but I don't have a clear idea of what would be a good api to expose.

@dp1
Copy link
Contributor Author

dp1 commented May 3, 2023

A little followup, I implemented a possible API for this over at dp1/z3.rs/decl-params.

I wrapped the possible result types in a DeclParam enum, and the intention is that accessing a parameter would work like this (ast here is a Dynamic):

    if ast.is_app() && ast.decl().kind() == DeclKind::ZERO_EXT {
        let DeclParam::Int(amt) = ast.decl().nth_param(0).unwrap() else { unreachable!(); };
        println!("ZeroExt by {amt} bits");
    }

If there's any interest I can open a PR for it, or rework it if there's a better solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant