Displaying 7 results from an estimated 7 matches for "expr_or_assign".
2009 Nov 25
1
Question R's parser : - parsing "x=\n 1"
Hello
I was reading the source main/src/gram.y and had one question, how does R parse
x =
1
According the grammar:
prog : END_OF_INPUT { return 0; }
| '\n' { return xxvalue(NULL,2,NULL); }
| expr_or_assign '\n' { return xxvalue($1,3,&@1); }
| expr_or_assign ';' { return xxvalue($1,4,&@1); }
| error { YYABORT; }
;
So this should be of the 3rd form.
Also, the expr_or_assign is of the 2nd form in
expr_or_assign : expr { $$ = $1; }...
2019 Aug 30
1
?Syntax wrong about `?`'s precedence ?
...from f(a<-b).)
Other tokens which have lower precedence than assignments are flow-control items, IF ELSE WHILE FOR REPEAT, but I don't see any way to confuse them in the same way as '?'.
It might be possible to resolve the situation by specifying '?' syntax explicitly as
expr_or_assign '?' expr_or_assign, but, well, "There be Tygers here"...
-pd
> On 30 Aug 2019, at 18:32 , Kevin Ushey <kevinushey at gmail.com> wrote:
>
> See also: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16710
>
> On Fri, Aug 30, 2019 at 9:02 AM William Dunl...
2016 Oct 21
3
anonymous function parsing bug?
...function
###
is this a bug or desired behavior? Using parenthesis of coures solves
the problem. However, I think the operator precedence could be the
problem here. I looked at the "./src/main/gram.y" and I think that the
line 385
| FUNCTION '(' formlist ')' cr expr_or_assign %prec LOW
should be of way higher precedence. But I cannot forsee the side effects
of that (which could be horrible in that case).
If this is the desired behaviour and not a bug, I'm very interested in
the rational behind that.
Best wishes,
Wilm
ps:
$ R --version
R version 3.3.1 (2016-06...
2016 Oct 21
3
anonymous function parsing bug?
...desired behavior? Using parenthesis of coures
> solves the problem. However, I think the operator precedence could
> be the problem here. I looked at the "./src/main/gram.y" and I
> think that the line 385
> | FUNCTION '(' formlist ')' cr expr_or_assign %prec LOW
> should be of way higher precedence. But I cannot forsee the side
> effects of that (which could be horrible in that case).
>
> If this is the desired behaviour and not a bug, I'm very
> interested in the rational behind that.
>
> Best wishes,...
2019 Aug 30
3
?Syntax wrong about `?`'s precedence ?
Precedence is a property of the parser and has nothing to do with the
semantics assigned to various symbols. Using just core R functions you can
see the precedence of '?' is between those of '=' and '<-'.
> # '=' has lower precedence than '?'
> str(as.list(parse(text="a ? b = c")[[1]]))
List of 3
$ : symbol =
$ : language `?`(a, b)
$
2016 Oct 21
0
anonymous function parsing bug?
...gt; is this a bug or desired behavior? Using parenthesis of coures solves the
> problem. However, I think the operator precedence could be the problem
> here. I looked at the "./src/main/gram.y" and I think that the line 385
> | FUNCTION '(' formlist ')' cr expr_or_assign %prec LOW
> should be of way higher precedence. But I cannot forsee the side effects
> of that (which could be horrible in that case).
>
> If this is the desired behaviour and not a bug, I'm very interested in the
> rational behind that.
>
> Best wishes,
>
> Wilm
>...
2016 Oct 21
0
anonymous function parsing bug?
...a bug or desired behavior? Using parenthesis of coures solves the
>> problem. However, I think the operator precedence could be the problem
>> here. I looked at the "./src/main/gram.y" and I think that the line 385
>> | FUNCTION '(' formlist ')' cr expr_or_assign %prec LOW
>> should be of way higher precedence. But I cannot forsee the side effects
>> of that (which could be horrible in that case).
>>
>> If this is the desired behaviour and not a bug, I'm very interested in
>> the rational behind that.
>>
>> Best...