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

Added support for freeing basic variables #2064

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

anutosh491
Copy link
Collaborator

The Pr adds support for Freeing the basic variables declared throughout the C generated code . For eg

(lf) anutosh491@spbhat68:~/lpython/lpython$ cat examples/expr2.py 
from sympy import Symbol, pi
from lpython import S

def main0():
    x: S = Symbol('x')
    y: S = Symbol('y')
    print(pi + S(100))

main0()

// Implementations
void main0()
{
    basic x;
    basic_new_stack(x);
    basic y;
    basic_new_stack(y);
    symbol_set(x, "x");
    symbol_set(y, "y");
    basic queue2;
    basic_new_stack(queue2);
    basic queue3;
    basic_new_stack(queue3);
    basic_const_pi(queue3);
    basic queue4;
    basic_new_stack(queue4);
    integer_set_si(queue4, 100);
    basic_add(queue2, queue3, queue4);
    printf("%s\n", basic_str(queue2));
    basic_free_stack(queue4);
    basic_free_stack(queue3);
    basic_free_stack(queue2);
    basic_free_stack(y);
    basic_free_stack(x);
}

@anutosh491
Copy link
Collaborator Author

cc @certik done.

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

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

I think this looks good, thanks!

@certik certik merged commit 32273ce into lcompilers:main Jun 30, 2023
@anutosh491 anutosh491 deleted the GSoC_PR4.1 branch June 30, 2023 23:36
@anutosh491 anutosh491 mentioned this pull request Jul 3, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants