Recognition algorithm for identifiers
bool IsId (w)
{ // Returns TRUE if w is a legal C++ identifier,
// Otherwise returns FALSE
if (w is of length 1)
if (w is a letter)
return TRUE;
else
return FALSE;
else if (last char of w is a letter or a digit)
return IsId(w minus its last char);
else return FALSE; }
Previous slide
Next slide
Back to first slide
View graphic version