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

Initial parser implementation #74

Merged
merged 5 commits into from
Jan 26, 2024
Merged

Conversation

certik
Copy link
Contributor

@certik certik commented Jan 24, 2024

The parser and AST was taken from LPython. In subsequent commits we will start modifying it to parse C++.

The parser and AST was taken from LPython. In subsequent commits we will
start modifying it to parse C++.
@certik
Copy link
Contributor Author

certik commented Jan 24, 2024

TODO: get --show-ast working.

@certik certik marked this pull request as draft January 24, 2024 22:16
@certik certik marked this pull request as ready for review January 25, 2024 05:57
@certik
Copy link
Contributor Author

certik commented Jan 25, 2024

@czgdp1807, @Shaikh-Ubaid I don't have time to completely finish it. Go ahead and take it from here, if this is good enough, you can merge it. We need to get --show-ast working and then start modifying the parser to parse C++ instead of Python. I would not bother with AST->ASR until we can parse enough of AST. So it's an orthogonal feature for now.

elif subs["MOD"] == "LC":
subs["MOD"] = "LC::AST"
subs["mod"] = "ast"
subs["lcompiler"] = "lpython"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be subs["lcompiler"] = "lc".

src/bin/lc.cpp Outdated
@@ -713,7 +713,7 @@ int mainApp(int argc, const char **argv) {
app.add_flag("--ast-print", ast_print, "Build ASTs and then pretty-print them");
app.add_flag("--ast-dump-filter", ast_dump_filter, "Use with -ast-dump or -ast-print to dump/print"
" only AST declaration nodes having a certain substring in a qualified name.");
app.add_flag("--show-ast", show_ast, "Show AST for the given file and exit");
app.add_flag("--show-clang-ast", show_clang_ast, "Show AST for the given file and exit");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
app.add_flag("--show-clang-ast", show_clang_ast, "Show AST for the given file and exit");
app.add_flag("--show-clang-ast", show_clang_ast, "Show Clang AST for the given file and exit");

Copy link
Collaborator

@Shaikh-Ubaid Shaikh-Ubaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me. Thank you so much for this. We can iterate on this.

@Shaikh-Ubaid Shaikh-Ubaid merged commit 50aa7ce into lcompilers:main Jan 26, 2024
2 checks passed
@certik certik deleted the parser branch January 26, 2024 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants