4 ms·
It would be useful to add a command line tool with a linq/jquery-like syntax over that. I've discovered few weeks ago the same feature (a bit hidden) in GCC:
by vmorgulis 11y ago
It would be useful to add a command line tool with a linq/jquery-like syntax over that.
I've discovered few weeks ago the same feature (a bit hidden) in GCC:
gcc -fdump-translation-unit=ast.txt file.c
It gives the AST in a flat map (parent/child with ids).
- yjgyhj 11y agoWell since it is s-expresssions (those paren things, looks like lisp), it is also very similar to JSON objects or XML elements. If you want to convert it to HTML you could do pretty easily. Use the car & cdr functions in lisp, and transform every car into a string like this `"<" + symbol + ">"`. Convert the closing paren to `"</" + symbol + ">"`. In the middle you put the result of cdr. https://en.wikipedia.org/wiki/CAR_and_CDR https://en.wikipedia.org/wiki/CAR_and_CDR Writing LISP is basically writing the AST without hiding it behind a textual syntax. The only textual syntax is the paren symbols that delimit the nodes in the syntax tree. It's a simpler way to live.