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

Properly implement scoping rules in the generated C++ code #375

Merged
merged 37 commits into from
Jul 6, 2021

Conversation

cmnrd
Copy link
Collaborator

@cmnrd cmnrd commented Jun 18, 2021

This PR prevents target code from accessing timers, ports, or actions that have not been declared as triggers, sources, or effects of the reaction in LF code. Accessing undeclared triggers, sources, or effects results in compiler errors. Also, scheduling an action that is only referenced as a trigger or source (but not an effect) results in a compile error (this is related to #339). There is actually no trivial way for the C++ programmer to circumvent this mechanism. Thus, this change should significantly improve the reliability of reactors written in C++.

This is based on the kotlin-cpp-generator branch and requires #356 and #345 to be merged first. I will mark this PR as draft until the other two PRs are merged.

Closes #66.
Closes lf-lang/reactor-cpp#1

@cmnrd cmnrd marked this pull request as draft June 18, 2021 13:48
@cmnrd cmnrd requested a review from lhstrh June 18, 2021 13:48
@cmnrd cmnrd added cpp Related to C++ target compiler labels Jun 18, 2021
@cmnrd cmnrd added this to the 0.1.0 Beta milestone Jun 18, 2021
@cmnrd cmnrd linked an issue Jun 28, 2021 that may be closed by this pull request
Base automatically changed from kotlin-cpp-generator to master June 29, 2021 20:57
@cmnrd cmnrd changed the title WIP: Properly implement scoping rules in the generated C++ code Properly implement scoping rules in the generated C++ code Jun 30, 2021
@cmnrd cmnrd marked this pull request as ready for review June 30, 2021 16:28
@cmnrd cmnrd requested review from lhstrh and oowekyala and removed request for lhstrh June 30, 2021 16:30
@cmnrd
Copy link
Collaborator Author

cmnrd commented Jun 30, 2021

@lhstrh This is ready for merging now.

Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

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

Excellent! Glad you managed to address this!

@lhstrh lhstrh merged commit bd6ad65 into master Jul 6, 2021
@lhstrh lhstrh deleted the cpp-scoping branch July 6, 2021 20:03
@cmnrd cmnrd mentioned this pull request Jul 12, 2021
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler cpp Related to C++ target
Projects
None yet
2 participants