restron
Member
Hi there,
I am currently working on a C# software tool that needs to compile RSLogix 5000 structure text (ST) language (IEC61131-3 + additional functionality added by Rockwell).
The compiler should convert ST code (plain text, see sample below) out of the L5X project file (xml format) to C# objects.
I am aware that I probably need to create a database with all RSLogix instructions (like the Motion instructions and Controller instructions).
Here's a ST code sample out of L5X project file:
Before I'll start implementing the compiler I've wanted to ask how you would proceed?
I've heared about the Backus-Naur form and the lexical analysis but I'm not sure if this is the right way to go. I already have advanced knowledge in C# programming, so deserializing from xml to objects is quite easy and not the question It's more about the method how to "understand" the code easily / correctly.
Do you guys have any advices / recommondations?
Big thanks in advance!
I am currently working on a C# software tool that needs to compile RSLogix 5000 structure text (ST) language (IEC61131-3 + additional functionality added by Rockwell).
The compiler should convert ST code (plain text, see sample below) out of the L5X project file (xml format) to C# objects.
I am aware that I probably need to create a database with all RSLogix instructions (like the Motion instructions and Controller instructions).
Here's a ST code sample out of L5X project file:
Code:
<STContent>
<Line Number="0">
<![CDATA[[COLOR="Blue"]ParamIndex:=0;[/COLOR]]]>
</Line>
<Line Number="1">
<![CDATA[[COLOR="blue"]FOR ParamIndex:=0 TO (ParamArraySize-1) by 1 do[/COLOR]]]>
</Line>
<Line Number="2">
<![CDATA[[COLOR="blue"] Calced.Parameter[ParamIndex] := 9999; [/COLOR]]]>
</Line>
<Line Number="3">
<![CDATA[[COLOR="blue"] Min.Parameter[ParamIndex]:=-9999; [/COLOR]]]>
</Line>
<Line Number="4">
<![CDATA[[COLOR="blue"] Max.Parameter[ParamIndex]:=9999; [/COLOR]]]>
</Line>
<Line Number="5">
<![CDATA[[COLOR="blue"]END_FOR;[/COLOR]]]>
</Line>
<Line Number="6">
<![CDATA[[COLOR="blue"] COP(ParamIndex, ParamIndexCopy,1);[/COLOR]]]>
</Line>
</STContent>
Before I'll start implementing the compiler I've wanted to ask how you would proceed?
I've heared about the Backus-Naur form and the lexical analysis but I'm not sure if this is the right way to go. I already have advanced knowledge in C# programming, so deserializing from xml to objects is quite easy and not the question It's more about the method how to "understand" the code easily / correctly.
Do you guys have any advices / recommondations?
Big thanks in advance!