Hi - On 11/21/16, 10:16 PM, "Tomsy Paul" <[email protected]> wrote:
>Hello all, > > >I am going through the chapel grammar (chapel.ypp). I miss something in >understanding the rules of stmt, to be precise, assignment_stmt involving >array elements on lhs. How does lhs_expr derive array expressions. for >example, the derivation of > > >A[i] = 10; > > >Could you please give the derivation of this statement. I'm basing this on looking through chapel.ypp (rather than, say, debugging output). A[i] = 10; turns into the tokens TIDENT TLSBR TIDENT TRSBR TASSIGN INTLITERAL TSEMI using assignment_stmt, we have lhs_expr TASSIGN expr TSEMI where lhs_expr is TIDENT TLSBR TIDENT TRSBR and expr is INTLITERAL then going in to lhs_expr, we have call_expr as one of the options. So now we have a call_expr TIDENT TLSBR TIDENT TRSBR and we match the rule call_expr: fun_expr TLSBR opt_actual_ls TRSBR where fun_expr is TIDENT (which is A) opt_actual_ls is going to match TIDENT (for i) but I won't go into detail on that here (but in this case it becomes actual_expr which becomes expr) Cheers, -michael ------------------------------------------------------------------------------ _______________________________________________ Chapel-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-developers
