However, I'm still a bit puzzled about what this means concretely in R and the outputs from
Consider the following example:
pryr::ast() returns an abstract syntax tree (AST) (according to the docs:
pryr::ast(z <- x + y) \- () \- `<- \- `z \- () \- `+ \- `x \- `y
as.list(quote() on the same expression I get:
as.list(quote(z <- x + y)) [] `<-` [] z [] x + y
Is this output also considered to be an AST? Or is this too vague to be an AST? Or is it a parse tree?
On the other side
susbtitute does return a parse tree (according to the docs:
as.list(substitute(z <- x + y, list(x = 1))) [] `<-` [] z [] 1 + y
..which is apart from the substituted
x the same as the output from quote..
So is this a parse tree? And is the difference between the parse tree and the AST only the substituted
x or something else?
Even worse, when considering the example from the accepted answer here I think the parse tree should be more precise than the AST, but when looking at the output from
quote I see quite the opposite, meaning the output from
pryr::ast is more precise than the one from
Thanks in advance for the enlightment..