python-starlark-go icon indicating copy to clipboard operation
python-starlark-go copied to clipboard

Access syntax tree?

Open tadamcz opened this issue 1 year ago • 3 comments

Great library, thanks so much for your work! I really appreciate e.g. how you've translated exceptions in a way that lets you easily access the line and column number of a Starlark error 👌.

Does Starlark provide a way to access the syntax tree of an expression? Is this something we could add to python-starlark-go? (If Starlark exposes the tree I'm happy to take a shot at it, but my go skills are very poor).

So, for example, in the Starlark code:

a = 1
b = 2
c = a * 2
result = b + c 

we could access the fact that result depends on b and c via the operator +, and in turn c depends on a (and a literal) via *.

tadamcz avatar Mar 30 '23 12:03 tadamcz