Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc: Figure out a solution for AST debugging #5

Open
atirut-w opened this issue Jul 9, 2024 · 1 comment
Open

cc: Figure out a solution for AST debugging #5

atirut-w opened this issue Jul 9, 2024 · 1 comment
Assignees
Labels

Comments

@atirut-w
Copy link
Owner

atirut-w commented Jul 9, 2024

It would seem that ANTLR Lab has been going through some shitstorm as of late. It first won't compile AST graphs, and now the website is entirely down. It's made me realize that a project like this will need a way to nicely visualize the AST without relying on ANTLR Lab.

Currently, the compiler has a --dump-ast option, but it's not human-readable by any means without some sort of post-processing or a custom dumper altogether. I dare you tell me this is immediately readable:

(compilationUnit (translationUnit (externalDeclaration (functionDefinition (declarationSpecifiers (declarationSpecifier (typeSpecifier int))) (declarator (directDeclarator (directDeclarator main) ( ))) (compoundStatement { (blockItemList (blockItem (statement (jumpStatement return (expression (assignmentExpression (conditionalExpression (logicalOrExpression (logicalAndExpression (inclusiveOrExpression (exclusiveOrExpression (andExpression (equalityExpression (relationalExpression (shiftExpression (additiveExpression (multiplicativeExpression (castExpression (unaryExpression (postfixExpression (primaryExpression ( (expression (assignmentExpression (conditionalExpression (logicalOrExpression (logicalAndExpression (inclusiveOrExpression (exclusiveOrExpression (andExpression (equalityExpression (relationalExpression (shiftExpression (additiveExpression (multiplicativeExpression (castExpression (unaryExpression (postfixExpression (primaryExpression 0))))))))))))))))) )))))))))))))))))) ;)))) })))) <EOF>)

Of course, I have zero experience in this regard, but making an issue like this can double as both a TODO and a sort of rep bounty.

@atirut-w
Copy link
Owner Author

Update: ANTLR Lab is now back online, but the point still stands.

@atirut-w atirut-w changed the title Compiler: Figure out a solution for AST debugging cc: Figure out a solution for AST debugging Jul 18, 2024
@atirut-w atirut-w self-assigned this Jul 18, 2024
@atirut-w atirut-w added the todo label Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant