AST in R programming

In lobstr.. ast(function(x) x^3) can i give this ast's output to Python interpreter Or any interperter or compiler.. to eval it. if yes.. how?

If you omit the ast symbol then the R interpreter will eval it.

Cheeky answer

please bro.. I'm serious is it possible?

its possible but I dont think anyone has had interest specifically creating software to parse the output of lobstr::ast function, so I doubt that any off the shelf solution is readily available.

Can you motivate why this might be of interest?

I was thinking how my r code convert into sql, spark..etc it done via c,c++,java api.
But i thought under the hood all source code represent as ast so I thinking to directly pass my ast to interpreter,jvm..

I'm afraid you are being naive about the differences between languages. you should expect that the abstract syntax trees are simply not compatible. Dedicated tools are used to do this where it has been automated. This is why migrating source language for a project is a hard task.
If you want to run R in python you should investigate rpy2

But clojure,scala,kotlin,groovy .. all compile to bytecode(.class file) if this is possible .. then R code compile to any language.. why it is difficult

those language were designed from the ground up to compile to the jvm, those were design choices of the creators of those languages

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.