One of the features of my compiler is supposed to be the ability to draw ASTs in browsers that support manipulating SVG from JavaScript (which includes basically any modern browser, including Internet Explorer 11). You can check it out here. An example AST it draws is this :
![[Image: seminar_html_32e0b75e29409762.gif]](https://flatassembler.github.io/QuickSort/seminar_html_32e0b75e29409762.gif)
While it works for such simple expressions, it fails to produce legible results for expressions with "deep" ASTs, such as even. The diagram it produces for that expression (and similar ones) is a lot wider than necessary. So, which algorithm would you use to draw ASTs? How would you implement it in JavaScript?
![[Image: seminar_html_32e0b75e29409762.gif]](https://flatassembler.github.io/QuickSort/seminar_html_32e0b75e29409762.gif)
While it works for such simple expressions, it fails to produce legible results for expressions with "deep" ASTs, such as even
Code:
1+2+3+4+5