+/*---------------------------------.
+| Create a new symbol, named TAG. |
+`---------------------------------*/
+
+static symbol_t *
+symbol_new (const char *tag, location_t location)
+{
+ symbol_t *res = XMALLOC (symbol_t, 1);
+
+ res->tag = xstrdup (tag);
+ res->location = location;
+
+ res->type_name = NULL;
+ res->destructor = NULL;
+
+ res->number = NUMBER_UNDEFINED;
+ res->prec = 0;
+ res->assoc = right_assoc;
+ res->user_token_number = USER_NUMBER_UNDEFINED;
+ res->alias = NULL;
+ res->class = unknown_sym;
+
+ nsyms++;
+ return res;
+}
+
+
+/*-----------------------------------------------------------------.
+| Return the tag of this SYMBOL in a printable form. Warning: use |
+| the first QUOTEARG slot: 0. |
+`-----------------------------------------------------------------*/
+
+const char *
+symbol_tag_get (symbol_t *symbol)
+{
+ return quotearg_style (escape_quoting_style, symbol->tag);
+}
+
+
+/*------------------------------------------------------------.
+| Return the tag of this SYMBOL in a printable form. Use the |
+| QUOTEARG slot number N. |
+`------------------------------------------------------------*/
+
+const char *
+symbol_tag_get_n (symbol_t *symbol, int n)
+{
+ return quotearg_n_style (n, escape_quoting_style, symbol->tag);
+}
+
+
+/*-------------------------------.
+| Print the tag of this SYMBOL. |
+`-------------------------------*/
+
+void
+symbol_tag_print (symbol_t *symbol, FILE *out)
+{
+ fputs (symbol_tag_get (symbol), out);
+}
+
+
+/*------------------------------------------------------------------.
+| Set the TYPE_NAME associated to SYMBOL. Does nothing if passed 0 |
+| as TYPE_NAME. |
+`------------------------------------------------------------------*/
+
+void
+symbol_type_set (symbol_t *symbol, char *type_name, location_t location)
+{
+ if (type_name)
+ {
+ if (symbol->type_name)
+ complain_at (location,
+ _("type redeclaration for %s"), symbol_tag_get (symbol));
+ symbol->type_name = type_name;
+ }
+}
+
+
+/*-------------------------------------------------------------------.
+| Set the DESTRUCTOR associated to SYMBOL. Do nothing if passed 0. |
+`-------------------------------------------------------------------*/
+
+void
+symbol_destructor_set (symbol_t *symbol, char *destructor, location_t location)
+{
+ if (destructor)
+ {
+ if (symbol->destructor)
+ complain_at (location,
+ _("%s redeclaration for %s"),
+ "%destructor", symbol_tag_get (symbol));
+ symbol->destructor = destructor;
+ symbol->destructor_location = location;
+ }
+}
+
+
+/*----------------------------------------------------------------.
+| Set the PRITNER associated to SYMBOL. Do nothing if passed 0. |
+`----------------------------------------------------------------*/
+
+void
+symbol_printer_set (symbol_t *symbol, char *printer, location_t location)