NOP0 / rustmatic

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

Implementation of IEC standard library. #25

Open NOP0 opened 4 years ago

NOP0 commented 4 years ago

There's a set of functions and function blocks that are regarded as standard library for IEC.

Examples are for instance; counter blocks, time delay blocks, edge detection blocks, string handling blocks and so on.

Should these be implemented in IEC or Rust, and what should the interface between the languages be, i.e. should we implement it in Rust so it can be callable from Rust, but then how do we call it from IEC? , and so on.

Michael-F-Bryan commented 4 years ago

I guess that all depends on our software model and how we want compilation to work.

If we were compiling structured text to WASM, the standard library would be implemented by providing various well-known functions and whenever the structured text program references something from the standard library, the compiler translates it to function calls. From there it doesn't really matter whether the functions are implemented in Rust or IEC. We just need to make sure the relevant symbols are available to the WASM virtual machine when we try to run the code (e.g. with ImportObject in wasmer).

I'd prefer to write as much of the IEC standard library in Rust though. I feel like we'll need better control and more powerful tools than IEC would normally give you (e.g. generics and std).

NOP0 commented 4 years ago

This sounds really good. It's ideal if we can write the standard library in Rust.

Related to #13