Skip to content

DEV: Sync libasr with LFortran #2827

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

Merged
merged 16 commits into from
Mar 30, 2025
Merged

DEV: Sync libasr with LFortran #2827

merged 16 commits into from
Mar 30, 2025

Conversation

czgdp1807
Copy link
Collaborator

@czgdp1807 czgdp1807 commented Feb 26, 2025

Steps to complete,

  1. Comment out tests to pass the integration tests.
  2. Then uncomment dict, set, list ones and keep the changes which are needed to pass them.
  3. Rest of them keep commented out.
  4. Merge.

strings_to_be_deallocated.p = strings_to_be_deallocated_copy;
}

void visit_ForEach(const ASR::ForEach_t &x) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this function / node was removed? It might be a specific node in LPython.

@certik
Copy link
Contributor

certik commented Feb 26, 2025

I think there was work in LPython to get various dicts and lists operations working, so it would be good to keep that if we can.

But I think it is more important to sync, and keep it synced after that, so if it is difficult, we can temporarily remove it, and try to add it back later (the proper way: in LFortran first, then update a submodule).

@@ -45,23 +45,23 @@ stmt
| GoToTarget(int id, identifier name)
| If(expr test, stmt* body, stmt* orelse)
| IfArithmetic(expr test, int lt_label, int eq_label, int gt_label)
| Print(expr* values, expr? separator, expr? end)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think end and separator are used in python syntax.

Copy link

Choose a reason for hiding this comment

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

They definitely are used in python syntax, but the ASR is supposed to be language agnostic, so I'm not really sure if we should've programming language details into ASR. Handle them in the frontend, and if it isn't possible, then have it in ASR.asdl of LFortran as well.

if (x.m_separator) {
this->visit_expr(*x.m_separator);
separator = src;
separator = "\" \"";
//HACKISH way to handle print refactoring (always using stringformat).
// TODO : Implement stringformat visitor.
Copy link
Contributor

Choose a reason for hiding this comment

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

let's keep combination of this as we should keep separator and end memebers.

Comment on lines -1190 to -1196
if (x.m_end) {
this->visit_expr(*x.m_end);
tmp_gen += "\%s\"";
v.push_back(src);
} else {
tmp_gen += "\\n\"";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

as well as keeping this.

@czgdp1807 czgdp1807 force-pushed the libasr_sync branch 3 times, most recently from ce689a9 to ede6e7f Compare February 27, 2025 13:59
@czgdp1807 czgdp1807 requested a review from certik March 24, 2025 17:31
@czgdp1807
Copy link
Collaborator Author

If you merge it then do squash and merge.

@@ -0,0 +1,551 @@
#pragma once
Copy link
Collaborator

Choose a reason for hiding this comment

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

this file should be automatically generated. Please add it to .gitignore.

@@ -0,0 +1,4688 @@
#pragma once
Copy link
Collaborator

Choose a reason for hiding this comment

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

same, this has to be generated automatically

@czgdp1807
Copy link
Collaborator Author

I would be busy. Please push the changes directly to my branch.

Copy link
Collaborator

@Pranavchiku Pranavchiku left a comment

Choose a reason for hiding this comment

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

I'm OK with these changes. I think sync will be complete once we get these tests one-by-one working.

@@ -1,4 +1,4 @@
from lpython import u8, u16, u32, u64
from lpython import u8, u16, u32, u64, i8
Copy link

Choose a reason for hiding this comment

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

Are the changes in this file needed for tests to pass?


// Generated by grammar/asdl_cpp.py

#include <libasr/alloc.h>
Copy link

Choose a reason for hiding this comment

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

I'm commenting here to make sure that we don't commit this either. So that one of us can undo it.

Copy link

Choose a reason for hiding this comment

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

this one as well.

Copy link

Choose a reason for hiding this comment

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

this one as well.

Copy link

Choose a reason for hiding this comment

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

this one as well.

Copy link

Choose a reason for hiding this comment

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

maybe this as well.

Copy link

Choose a reason for hiding this comment

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

maybe this as well.

Copy link

Choose a reason for hiding this comment

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

maybe this as well

Copy link

Choose a reason for hiding this comment

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

maybe this as well.

@@ -0,0 +1,569 @@
#pragma once
Copy link

Choose a reason for hiding this comment

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

maybe this as well.

@certik certik merged commit cae555e into lcompilers:main Mar 30, 2025
18 checks passed
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.

5 participants