Skip to content

Conversation

palinatolmach
Copy link
Contributor

@palinatolmach palinatolmach commented Jul 2, 2024

Draft implementation for #650.

This PR adds a new src/kontrol/solidity folder that contains an antlr4 grammar for a subset of Solidity we want to use in NatSpec comments specifying preconditions.

It also adds a Precondition class (to be refactored further) that contains a to_kapply property, which translates the parsed string to a KApply term representing the constraint. For example, the following test passes

    /// @custom:kontrol-precondition x <= 14,
    function testPrecondition(uint256 x) public pure {
        assert(x <= 14);
    }

because the following constraint get added to the initial term:

#And ( { true #Equals VV0_x_114b9705:Int <Int 14 }

@palinatolmach palinatolmach changed the title CSE: support for user-defined preconditions Support for user-defined preconditions Aug 1, 2024
@palinatolmach palinatolmach self-assigned this Aug 2, 2024
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.

2 participants