question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to access the parsed AST, with the inferred types? I want to write a code translation tool, and knowing the types would be very useful. I mean, having a regular AST (similar to ast.AST) but with added attributes, such as: declared_type, and inferred_types.

I tried to look through the code, but couldn’t figure it out.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:46 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
JelleZijlstracommented, May 22, 2021

There is something like that, the CallSiteCollector class in name_check_visitor.py. I think in our internal code we have a function get_call_map(); I can look into moving that to the public part of pyanalyze.

1reaction
JelleZijlstracommented, May 5, 2021

It’s green now! Happily the tests uncovered a few more places where we weren’t adding annotations to the AST.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How should I represent an AST annotated with additional ...
I can use this to write a simple evaluation function which matches against the AST structure: eval :: Term -> Result eval (Var...
Read more >
Annotate AST with location information : r/haskell - Reddit
Annotate AST with location information. Hello everyone,. I'm currently writing a parser using megaparsec which produces the following output ...
Read more >
ast — Abstract Syntax Trees — Python 3.11.1 documentation
annotation is the annotation, such as a Constant or Name node. value is a single optional node. simple is a boolean integer set...
Read more >
Abstract syntax tree - Wikipedia
In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of text...
Read more >
Annotated AST for an If-Statement. - ResearchGate
One of the most fundamental issues in program understanding is the is-sue of representing the source code at a higher level of abstraction....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found