rebcabin / masr

Meta ASR: replacement for aging ASDL
MIT License
4 stars 0 forks source link

Meaning of `=` in `--show-asr`? #21

Open rebcabin opened 1 year ago

rebcabin commented 1 year ago

In recent output format, I see

(= (Var 2 a)
              (LogicalConstant false (Logical 4 []))
              ())

I can't find anything in ASR.asdl that matches=. I presume it's shorthand for one or more of the binops, but it's ambiguous and creates a problem for MASR, which now must inspect the arguments to figure out which binop.

logicalbinop = And | Or | Xor | NEqv | Eqv
cmpop = Eq | NotEq | Lt | LtE | Gt | GtE
rebcabin commented 1 year ago

Also, more importantly, and a BLOCKER: what is the third argument in

(= (Var 2 a)
              (LogicalConstant false (Logical 4 []))
              ())

? its value is (), but I can find nothing in ASR.asdl that tells me what it might mean?

rebcabin commented 1 year ago

As a temporary workaround, I am going to invent an undocumented Equals : expr expression that tests structural equality on its arguments:

(Equals foo bar _ignored)
rebcabin commented 1 year ago

Looks like it's a stmt, Assignment in fact. The third argument is stmt? overloaded. Don't know what it means. What's an "overloaded assignment?" Something to support C++?

rebcabin commented 1 year ago

1718b05 (HEAD -> brian-macro-experiment, origin/brian-macro-experiment) Assignment instead of Equals

certik commented 1 year ago

We need to change it to Assignment. I'll keep this open until then.

rebcabin commented 1 year ago

I did a "legacy" macro to rewrite = to Assignment in the mean time. It's another "moving part," so additional risk and I'd like to get rid of the macro.

On Fri, Apr 28, 2023 at 4:32 PM Ondřej Čertík @.***> wrote:

We need to change it to Assignment. I'll keep this open until then.

— Reply to this email directly, view it on GitHub https://github.com/rebcabin/masr/issues/21#issuecomment-1528199122, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABSRR5CYGBOYRUA265SS7TXDRHRHANCNFSM6AAAAAAXN2JX64 . You are receiving this because you modified the open/close state.Message ID: @.***>