act icon indicating copy to clipboard operation
act copied to clipboard

# Syntax: Change rewrite arrow to `<-`

Open mrscottyrose opened this issue 10 months ago • 8 comments

Description

This PR implements the enhancement requested in Issue #128.

Currently, both rewrites and implications use the same => syntax in Act specifications, which can be confusing. This PR changes the rewrite arrow to <- while keeping implications as =>, making specifications easier to write and read.

Changes

  • Added a new LARROW token to the lexer for the <- symbol
  • Updated the parser rule to use <- instead of => for rewrites
  • Modified the pretty printer to display rewrites with <- instead of =>

Example

Before:

storage
  balanceOf[CALLER] => balanceOf[CALLER] - value
  balanceOf[to] => balanceOf[to] + value

After:

storage
  balanceOf[CALLER] <- balanceOf[CALLER] - value
  balanceOf[to] <- balanceOf[to] + value

This makes it easy to visually distinguish between rewrites (using <-) and implications (using =>).

Testing

I've verified that the changes properly handle the new syntax by:

  1. Adding the token to the lexer
  2. Updating the parser rule
  3. Modifying the pretty printer

The implementation is minimal and focused solely on addressing the syntax issue described in #128.

Related Issue

Resolves #128

mrscottyrose avatar Apr 18 '25 10:04 mrscottyrose

Hi @mrscottyrose,

Thanks for the contribution! The updated syntax is definitely an improvement—it helps eliminate ambiguity and makes specifications easier to read.

That said, before we can merge this PR, all existing examples in the tests directory will need to be updated to use the new <- syntax. Otherwise, the CI tests will fail.

Just a quick note: Act is still under active development, and the syntax may undergo changes in the future.

Thanks again!

zoep avatar Apr 20 '25 18:04 zoep

Hey @zoep could you please check if everything's alright now

mrscottyrose avatar Apr 28 '25 14:04 mrscottyrose

The tests will still not pass as => should be replaced with <- in every file in the tests directory.

zoep avatar Apr 30 '25 11:04 zoep

Hey @zoep Just to confirm—should I update every file and subdirectory under the tests directory where => is used, replacing it with <-, regardless of the file depth?

mrscottyrose avatar May 01 '25 07:05 mrscottyrose

Yes, exactly. Eventually, CI must turn green.

zoep avatar May 02 '25 11:05 zoep

hey @zoep I've updated all occurrences of => to <- across the entire tests directory . Despite this, the CI is still failing.

mrscottyrose avatar May 07 '25 16:05 mrscottyrose

There is a build issue with the lexer. Have you tried building locally?

zoep avatar May 07 '25 19:05 zoep

Thanks, @zoep! That definitely clarifies things. I’m currently on Windows, so I don’t have a proper Nix environment set up to test the build locally. I’ll rely on CI for now , let me know if there’s a better workaround you’d recommend.

mrscottyrose avatar May 27 '25 18:05 mrscottyrose