Live data from Hacker News

Show HN: Copy-and-patch compiler for hard real-time Python

github.com

11–13 of 13 posts

Re: Show HN: Copy-and-patch compiler for hard real-time Python

#13
post #4

[flagged]

In some fields its quite common to implement state machines in an imperative style with if-blocks and flags. That should be possible with Copapy by having decorated functions where the decorator parses the AST and replaces if-blocks with cp.iif() to end up with branchless code.

However, from my experience this programming style is ok for simple state machines, but it’s definitely not great, and if things get more complex, it’s getting really hard to keep it comprehensible and correct.

I think the main challenge is the design of an API that fits state machines. Concerning the WCET, branchless code should be on average not worse than branched code.

Post reply on HN