Skip to content

Conversation

@parisaF163
Copy link
Collaborator

add pre and post-condition in veracity parser and its translation to Servois spec

| ASSUME e=exp SEMI { loc $startpos $endpos @@ Assume e }
| HAVOC i=IDENT SEMI { loc $startpos $endpos @@ Havoc i }
| variant=commute_variant phi=commute_condition
LBRACE PRE COLON pre=exp blocks=nonempty_list(block) POST COLON post=exp RBRACE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Merge this rule with the above rule while making the parsing of the pre/post an Option.

src/vcy/ast.ml Outdated
| Assume of exp node
| Havoc of id
| Require of exp node
| GCommute of commute_variant * commute_condition * commute_pre_cond * block node list * commute_post_cond
Copy link
Collaborator

Choose a reason for hiding this comment

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

| Commute of commute_variant * commute_condition * block node list * commute_pre_cond option * commute_post_cond option

end
| Assume _ | Havoc _ ->
env, None (* We simply ignore 'assume's and 'havoc's at runtime *)
(* | GCommute (variant, phi, pre, blocks, post) ->
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does GCommute just error on runtime? (Should be fixed if we merge with the Commute case as noted before).

Semantics for pre/post conditions? Do we want those to behave like assumptions/assertions and error if they aren't satisfied?

| (* empty *) { loc $startpos $endpos @@ [] }
| ELSE b=block { b }
| ELSE ifs=if_stmt { loc $startpos $endpos @@ [ ifs ] }
| ELSE ifs=if_stmt { loc $startpos $endpos @@ [ ifs ] } No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a trailing endline

Crazycolorz5 referenced this pull request in veracity-lang/veracity2g Jan 24, 2025
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.

4 participants