Conversation
46bec88 to
fafde11
Compare
fafde11 to
cd73fc7
Compare
This allows ast object to be broken apart into its operator and operands.
|
This is great! I've been looking at the connections between ast and sexprs. Would using Hy have any advantage if we can translate between code and sexprs? This makes me think if we can build parsers as well. Generating a parser given a spec would be insane. |
Hy would be convenient for a number of reasons (e.g. manipulating AST), but a lot of the same work would be involved regardless. Take a look at
I would like to get some coverage for the basic control flow statements (e.g.
Yes, that can be—and is effectively being—done. |
This PR introduces a simple relational typing example for Python AST.
This implementation is based on Racket examples provided by @jasonhemann.
ast.args withast.Name(i.e. "symbols")Sequencesast.Ifast.Assignast.Exprast.Calloperator.getitemExample
Here's a very simple example that infers the type of a
defstatement:The goal has inferred that the statement is a
Callablewith an unground logic variable (i.e.~tx_2408) as the type of its only argument (this could be interpreted astyping.Any) and afloat-typed return value that was derived from the type promotion in the expression1 + 1.0.