I'm happy to announce that the OPLC Compiler is out for the first alpha version. Currently it has the same capabilities as the compiler embedded on the original OpenPLC Ladder IDE. Therefore, it should compile any ladder code created on that IDE or on LDmicro targeting ANSI C code.
The next step for the OPLC Compiler is to add support for PWM, Serial and custom libraries, such as PID. But I will not work on it now. First, I want to write the hardware layer to make the OPLC Compiler usefull on hardware boards, such as the Raspberry Pi, Arduino and others. This hardware layer is the code that will actually bind the output of the OPLC Compiler with the hardware I/Os, bringing the ladder code into life.
This is the first step to the OpenPLC project goal of being truly multi platform. I'm excited with the results I'm having so far. The compiler can run on Linux, Windows and MacOS platforms. I even tried it on embedded Linux ARM devices and it worked with no modifications to the source code! This means that the code is generic enough to run on any platform.
If you want to try the compiler, download the source on github and compile it:
g++ *.cpp -o OPLC_Compiler
Download Visual Studio Community (free) and create a new empty Console Application. Import all the files (.cpp and .h) to your project and compile.
To run, just type OPLC_Compiler [source.ld] [dest.cpp]. The destination is optional. If it is not provided, the compiler will create a file named "ladder.cpp" as default output file.