NOP0 / rustmatic

PLC programming in Rust!
Apache License 2.0
35 stars 2 forks source link

WIP: Started lowering ST to our MIR #42

Open Michael-F-Bryan opened 4 years ago

Michael-F-Bryan commented 4 years ago

(Closes #40)

Michael-F-Bryan commented 4 years ago

@NOP0, are you able to review this new "lowering" code (in particular iec/src/lowering/st.rs) and let me know if you understand what it's trying to do?

Also, looks like our rustmatic_structured_text::parse() function doesn't actually do anything :rofl: I'll need to implement enough so I can start running the "integration test" for the lowering process.

NOP0 commented 4 years ago

@NOP0, are you able to review this new "lowering" code (in particular iec/src/lowering/st.rs) and let me know if you understand what it's trying to do?

Yes, for sure. :+1: It'll take me some days though, a quick scrollthrough tells me I'm in deep waters. It will be interesting! :smile:

Also, looks like our rustmatic_structured_text::parse() function doesn't actually do anything rofl I'll need to implement enough so I can start running the "integration test" for the lowering process.

Yeah I also noticed that :stuck_out_tongue_winking_eye:

NOP0 commented 4 years ago

I've gone through it all, I resolved some of my own comments that were trivial/just for my own understanding. I had to read up a bit on specs, I must say that crate is really nice.

There's a lot of interesting code here, but I think I understand, please correct me.

What are the next passes? E.g. I noticed that the body of the function is not handled in this pass.

Michael-F-Bryan commented 4 years ago

Yes, that summary is correct.

I'm planning to also convert the function body to a "basic block" form. That'll effectively remove all loops and conditionals and replace them with gotos. This tends to make things a lot easier to reason about because you'll have a sequential chain of instructions, then at the bottom of the block you'll either return or jump to another node.

Unfortunately I can only use my phone for a couple days. I'm a radio operator for the west Australian emergency services and have been out on a deployment for the last 2 or 3 days. I finish up in 3 days so I'll be able to continue once I've flown back in.

NOP0 commented 4 years ago

Unfortunately I can only use my phone for a couple days. I'm a radio operator for the west Australian emergency services and have been out on a deployment for the last 2 or 3 days. I finish up in 3 days so I'll be able to continue once I've flown back in.

No worries mate, I'm guessing it's the fires. It's all over the news here also, and there's even people deployed from my country half around the globe.