[antlr-interest] how to best break apart multiple assignments

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Wed Apr 1 03:01:39 PDT 2009


Bruce Bauman wrote:
> In the sometimes bizarre dialect of Pascal I am using (MetaWare), the following is allowed:
>  
> Odd := Even := 0;

It's also worth noting that in many languages this isn't considered to 
be strange. You just evaluate the assignment operator right-to-left; the 
value of an assignment expression is the value that was assigned. The 
AST would be like

(ASS Odd (ASS EVEN 0))

I'm sure in your case the dialect your translating to doesn't like it, 
or you wouldn't be worried, but I thought it was worth mentioning as 
background.

-- 
Sam Barnett-Cormack


More information about the antlr-interest mailing list