sm1820 / matiec

A maintained IEC61131 to C transpiler
GNU General Public License v3.0
32 stars 6 forks source link

Translation to other languages #1

Open hiperiondev opened 2 years ago

hiperiondev commented 2 years ago

It is excellent that someone keep this project

It would be interesting to add the translation to other languages. I was thinking about LUA, since it has a very portable and highly extensible VM

jubnzv commented 2 years ago

Hey @hiperiondev ,

Thank you for your interest to this project. I left @sm1820 this year, so I can't speak for them. But I want to clarify some points and share my personal opinion.

First of all, this fork is maintained by the commercial company. See their site for more information (you'll need to use google translate to read). This fork exists only because we needed to save our changes with bug fixes somewhere in public domain (according to GNU GPL license). The original matiec is not maintained, and I could not agree with the maintainer about pushing our fixes to upstream. So, as you see, our repository is not in active development, and as far as I know, this is not planned.

Second, matiec supports only a limited subset of features from the third edition of IEC61131-3 standard. For example, you can not use OOP features, namespaces and other useful things.

I think, if you are interesting in creating a new backend for the modern IEC61131-3, you should consider the following options. You could create your own matiec fork and heavily rework/improve its codebase. You will probably have to completely rewrite its backend, because code generated with it is strongly tied to the use of specific C macros. You also can check rusty and try to reuse their frontend, replacing the LLVM backend with Lua codegen. Or use iec-checker as a frontend for your new transpiler. Another option, of course, will be creating your own transpiler from the ground up which also makes sense in this case.

hiperiondev commented 2 years ago

Thanks for your reply PLC is a very closed topic, there are very few open things (although there are quite a few free ones) I am going to investigate rusty, and other sources that I have found.