+     Construct names from it.  */
+  else
+    {
+      if (spec_file_prefix)
+       {
+         /* If --file-prefix=foo was specified, SHORT_BASE_NAME =
+            `foo'.  */
+         short_base_name = xstrdup (spec_file_prefix);
+       }
+      else if (yacc_flag)
+       {
+         /* If --yacc, then the output is `y.tab.c'. */
+         short_base_name = xstrdup ("y");
+       }
+      else
+       {
+         /* Otherwise, the short base name is computed from the input
+            grammar: `foo/bar.yy' => `bar'.  */
+         filename_split (grammar_file, &base, &tab, &ext);
+         short_base_name =
+           xstrndup (base,
+                     (strlen (base) - (ext ? strlen (ext) : 0)));
+       }
+
+      full_base_name = xmalloc (strlen (short_base_name)
+                               + strlen (TAB_EXT) + 1);
+      stpcpy (stpcpy (full_base_name, short_base_name), TAB_EXT);
+
+      /* Compute the extensions from the grammar file name.  */
+      filename_split (grammar_file, &base, &tab, &ext);
+      if (ext && !yacc_flag)
+       compute_exts_from_gf (ext);
+    }