"'serial' not declared in this scope" error
Serial must be UPPERCASE as this class is case sensitive

Therefore your code will be:

const float referenceVolts = 5.0;
const int batteryPin = 0;

void setup()  {
Serial.begin(9600);
}

void loop()  {
int val = analogRead(batteryPin);
float volts = (val / 1023.0) * referenceVolts;
Serial.println(volts);
}