Expose Parser/AST Internals
See original GitHub issueHi all, I’m trying to root around and see if I can re-use the parser and intermediate-representation (perhaps an AST?) that the Cython project uses for a separate project of mine. I’ve been able to find several wiki pages proposing changes to the system (ref1, ref2), but no up-to-date (read: 2016) summary of the system.
It’s been awhile since I’ve used Cython, but I remember really enjoying the commented-out Python code printed above each block of generated C code, it greatly helped with debugging. The Python ast
module doesn’t support such a thing, although I believe the lib2to3
module does (although it seems a bit more heavy-weight).
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Abstract Syntax Tree - powershell.one
The Abstract Syntax Tree (AST) groups tokens into meaningful structures and is the most sophisticated way of analyzing PowerShell code.
Read more >TypeScript Compiler Internals · TypeScript Deep Dive (Korean)
We have a project called Bring Your Own TypeScript (BYOTS) which makes it easier to play around with the compiler API e.g. by...
Read more >Read JavaScript Source Code, Using an AST - DigitalOcean
A quick guide to automate extracting information from your JavaScript code with abstract syntax trees (AST).
Read more >CSE P 501 – Compilers - Washington
Will do our best to sanity check over the weekend before parser/AST. • New HW3 (LR constr., ... ∴May need to expose more...
Read more >RustPython
Overview of RustPython internals parser/compiler/vm/imports ... Lexer, parser, AST (Abstract Syntax Tree). - Compiler ... Exposing the eval() to JavaScript.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a note, after dabbling a bit on the cython code, I’m using
to obtain the AST and it seems it’s working properly for me (as a note, I started with
TreeFragment
but went forparse_from_strings
because withTreeFragment
changes the source code removing empty lines, which means that lines don’t match with that API).Thanks @scoder ! My issue is that that would still miss some types - for example:
prints
, rather than
{'void', 'int', 'bar', 'baz'}
. This is becauseFusedTypeNode.childattrs
is emptyI have to patch this by adding
'types'
tochild_attrs
- would this (and the other patches in the link) be OK to do here inCython
directly? I asked about this one in the mailing list and was told