0

I have a very large .xlsx file(over 10000 lines of code) that contains a code written in C but has a lot of syntax errors and I need to convert it (using Python) to C code and syntax correct in C language. Is there a way to automatically check for syntax errors and fix it?

A sample code of code in that xlsx file:

raw=phys

Xposition=fDistX+MountingOffserLong+WheelBase
if (Xposition>255,75)
\{
raw = 255,75/0.0625
\}
else if (Xposition<0)
\{raw = 0
StatusMeasurementXX=0x3h (invalid)
ObjectInvalid = 1
\}
else
\{
raw = Xposition/0.0625
\}
/* ObjectInvalid flag will be..... */

if (ObjectInvalid<1) then
\{ do nothing \}
else
\{
raw=100
\}

And I want to transform that code to look like this:

raw=phys;

Xposition=fDistX+MountingOffserLong+WheelBase;
if (Xposition>255,75)
{
raw = 255,75/0.0625;
}
else if (Xposition<0)
{
raw = 0;
StatusMeasurementXX=0x3h; //(invalid)
ObjectInvalid = 1;
}
else
{
raw = Xposition/0.0625;
}
/* ObjectInvalid flag will be..... */

if (ObjectInvalid<1)
{}
else
{
raw=100;
}

0 Answers0