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

Is it possible to access the code generation process of Cython, to use goto/switch statements of the C language #3197

Open
thautwarm opened this issue Oct 20, 2019 · 2 comments

Comments

@thautwarm
Copy link

@thautwarm thautwarm commented Oct 20, 2019

I'm curious about generating code targeting Cython ASTs or other representations, and I want to generate goto/label/switch statements there, is it possible for Cython?

@scoder

This comment has been minimized.

Copy link
Contributor

@scoder scoder commented Oct 26, 2019

What is your concrete use case?

Cython generates C switch-statements automatically, for example, but goto is not part of the Python language and usually replaced by other, more high-level mechanisms. Without knowing what you want, I can't say if any of those match up with your intentions.

@thautwarm

This comment has been minimized.

Copy link
Author

@thautwarm thautwarm commented Oct 26, 2019

I'm using cython to make a JIT compiler now, and it works now: https://github.com/thautwarm/restrain-jit/blob/master/tests/becy/test_loop.py

As a workaround, I use a big while and a series of if statements to represent distinct basic blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.