Expected primary-Expression before 'sonic'

#include <Servo.h>

Servo sonic (int);

const int IN1 = 5;
const int IN2 = 6;
const int IN3 = 9;
const int IN4 = 10;
#define IR_sensor_front A0 // front sensor
#define IR_sensor_back A1 // rear senson
int distance ;

void setup()
delay (5000); // as per sumo compat roles
void loop()
int IR_front = analogRead(IR_sensor_front);
int IR_back = analogRead(IR_sensor_back);
distance = Servo sonic.read();
ROTATE(200); // start rotete if (distance < 20){

In order to properly assist you please include the entire results from the compiler and indicate which line the error is occurring on. We cannot help with just a code dump.

distance = Servo sonic.read();

You have go to post the full compiler results: No where do no mention what processor your are using?

You have some syntax errors in your code:

Servo sonic; creates the object, do not type cast the (int)

Then you have distance = Servo sonic.read();

Do not put the object type of Servo on the same line as the read().

distance = sonic.read();

Here is an example:

Arduino Servo example

Look at the example code for the servo library. You can't make up your own syntax. What you have is all wrong.

You also need to attach the servo.

Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.