title: C to IEC 61131-3 IL compiler
body: <p>I have a requirement for porting some existing C code to a <a href="http://en.wikipedia.org/wiki/IEC_61131-3" rel="nofollow noreferrer">IEC 61131-3</a> compliant PLC. </p>
  
  <p>I have some options of splitting the code into discrete function blocks and weaving those blocks into a standard solution (Ladder, FB, Structured Text etc).  But this would require carving up the C code in order to build each function block.  </p>
  
  <p>When looking at the IEC spec I realsied that the <a href="http://en.wikipedia.org/wiki/Instruction_list" rel="nofollow noreferrer">IEC Instruction List</a> form could be a target language for a compiler.   The wikepedia article lists two development tools:</p>
  
  <ol>
  <li><a href="http://www.3s-software.com/" rel="nofollow noreferrer">CoDeSys</a></li>
  <li><a href="http://www.beremiz.org/" rel="nofollow noreferrer">Beremiz</a></li>
  </ol>
  
  <p>But these seem to be targeted compiling IEC languages to C, not C to IEC.</p>
  
  <p>Another possible solution is to push the C code through a C to Pascal translator and use that as a starting point for a <a href="http://en.wikipedia.org/wiki/Structured_text" rel="nofollow noreferrer">Structured Text</a> solution.</p>
  
  <p>If not any of these I will go down the route of splitting the code up into function blocks.</p>
  
  <p><b>Edit</b></p>
  
  <p>As prompted by mlieson's reply I should have mentioned that the C code is an existing real-time control system. So the programs algorithms should already suit a PLC environment. </p>