Re: Pattern Matching

Gut ich habe den Automat verbessert - der alte war reine Katastrophe und hat for mit Rekursion vermischt

int automat (int xreal, int xtext) {
    int flag = 0;

    if (strlen (text) <= xtext)
      return 1;
    if (realstateschar [xreal] == CONTROLSTATE) {
      if (realstates1 [xreal] == realstates2 [xreal])
        flag = automat (realstates1 [xreal], xtext);
      else
        flag = automat (realstates1 [xreal], xtext) || automat (realstates2 [xreal], xtext);
    }
    else if ((realstateschar [xreal] >= 'a') \&amp;\&amp; (realstateschar [xreal] <= 'z'))  {
      if (realstateschar [xreal] == text [xtext])
        flag = 1;
      if (realstates1 [xreal] == realstates2 [xreal])
        flag \&amp;= automat (realstates1 [xreal], xtext+1);
      else
        flag \&amp;= (automat (realstates1 [xreal], xtext+1) || automat (realstates2 [xreal], xtext+1));
    }
    return flag;
}