Skip to content

Conversation

@coeff-aij
Copy link

This attribute allows users to inject arbitrary string literals directly into the generated .smt2 files using crate-level inner attributes.

  • Usage
    By adding an inner attribute to the crate root, such as:
#![feature(custom_inner_attributes)]
#![thrust::raw_define("(define-fun is_double ((x Int) (doubled_x Int)) Bool
    (=
        (* x 2)
        doubled_x
    )
)")]

// -- snip --

The attached string literal will be inserted into the head of the generated SMT-LIB2 file:

(set-logic HORN)

(define-fun is_double ((x Int) (doubled_x Int)) Bool
    (=
        (* x 2)
        doubled_x
    )
)

; -- snip --
  • Motivation
    This feature is intended for debugging and testing. It enables the manual injection of SMT-LIB logic, serving as a workaround until a dedicated parser is implemented.

@coeff-aij
Copy link
Author

Probably I have to add some more tests and documentation comments.

@@ -0,0 +1,20 @@
//@error-in-other-file: UnexpectedToken
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can I test that the Thrust panics with a specific error message? I tried using //@error-in-other-file, but I might be misunderstanding its purpose.

let ts = analyze::annot::extract_annot_tokens(attrs.clone());
let parser = annot::AnnotParser::new(
// TODO: this resolver is not actually used.
analyze::annot::ParamResolver::default()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseg_raw_definition() is implemented on annot::AnnotParser and it's new() requires any Resolver instance, which isn't actually used in parsing of raw definitions.
I might have to fix so that no Resolver is required for this analysis.

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

Successfully merging this pull request may close these issues.

1 participant