Re:Show HN: A complete Bash parser in JavaScript transpiled ...
by monocasa on Wednesday May 16, 2018 @09:28PM
(#17087938)
Isn't the AST there, but just hidden? It looks like the AST is the compiler's stack, it's just building the tree while doing a DFS and then cleaning up after itself as it goes.
Super cool though. Thanks!
Re:Show HN: A complete Bash parser in JavaScript transpiled ...
by badsectoracula on Thursday May 17, 2018 @08:06AM
(#17090588)
I think calling the call stack an AST is stretching things a bit :-P. Turbo Pascal (and most of Wirth's own compilers) is a simple recursive descent compiler that emits code almost as soon as it scans a token and it keeps very little information around.
https://www.pcengines.ch/tp3.htm