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

Introduce property expression to avoid evaluating properties too early #51

Merged
merged 4 commits into from
Aug 26, 2024

Conversation

falkoschindler
Copy link
Collaborator

@falkoschindler falkoschindler commented Jun 28, 2024

This PR tries to fix #36 and part of #18 by not evaluating property getters during compilation.

Open tasks:

  • Fix this example:

    when core.debug == true then core.print('DEBUG'); end
  • Why is this example not working?

    let wait do; await core.debug == true; core.print('done'); end

    When calling wait() and setting core.debug = true, there should be a message "done".

  • Fix this example:

    serial = Serial(26, 27, 115200, 1)
    p0 = Expander(serial, 25, 14)
    b = p0.Input(5)
    b.pullup()
    
    when b.level == 0 then core.print("DOWN"); end
    when b.change > 0 then core.print("PRESS"); end

    This startup script fails, because the compiler needs to read b.level and b.change to get their datatype. But they are undefined until the expander has started.

@falkoschindler falkoschindler added the bug Something isn't working label Jun 28, 2024
@falkoschindler falkoschindler self-assigned this Jun 28, 2024
@falkoschindler falkoschindler added this to the 0.1.12 milestone Jun 28, 2024
@falkoschindler falkoschindler modified the milestones: 0.1.12, 0.2.0 Jul 8, 2024
@falkoschindler falkoschindler modified the milestones: 0.2.0, 0.3.0 Jul 17, 2024
@falkoschindler falkoschindler marked this pull request as ready for review August 22, 2024 15:52
@falkoschindler
Copy link
Collaborator Author

Yay, I finally finished this pull request! 🎉

@Johannes-Thiel @JensOgorek Let's review it together next week. This way I can introduce you a little more to how the Lizard language is parsed and compiled.

Copy link
Contributor

@JensOgorek JensOgorek left a comment

Choose a reason for hiding this comment

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

Seems good

@falkoschindler falkoschindler merged commit 4a99eb7 into main Aug 26, 2024
@falkoschindler falkoschindler deleted the properties branch August 26, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error Accessing change Attribute of Input on Expander Module
2 participants