Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Nice. Would be good to do it with Python.


Author here. I am guessing you mean display the parse trees for python snippets?

It wouldn't be too difficult to do in backend code, using something like https://docs.python.org/2/library/ast.html.

It might be tricky to get it to work completely in the frontend, like the demos in this article.


Yeah ... I've turned the parse tree output from Baron (https://github.com/PyCQA/baron) into HTML -- using span elements to represent the subtrees in the Baron AST. It was quite trivial (less than 200 lines including comments). I am now trying to see how I can add different representations to the rendered html output. I would like to show the abstract syntax tree, the data dependency graph, the control flow graph; the output of git blame; perhaps deltas over time; test coverage and various bits of requirements and test results traceability information alongside the code somehow. Lots of stuff. :-)


All in the back-end --- I just want it as standalone single-file HTML w/ no server infrastructure required.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: