rustmatic
rustmatic copied to clipboard
WIP: Started lowering ST to our MIR
(Closes #40)
@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, 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:
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.
-
At this point the parsing is finished, so the st file parsed ok. The functions were stored in the
ast::File
struct -
We start adding stuff (names, variables, types etc) to the world, symbol table, and global scope
-
We unpack the function variables/parameters into a form that I guess is more suited for later passes.
-
The result is the entire global scope as a CompilationUnit
What are the next passes? E.g. I noticed that the body of the function is not handled in this pass.
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.
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.