+ status status;
+};
+
+/** Undefined user number. */
+#define USER_NUMBER_UNDEFINED -1
+
+/* `symbol->user_token_number == USER_NUMBER_HAS_STRING_ALIAS' means
+ this symbol has a literal string alias. For instance, `%token foo
+ "foo"' has `"foo"' numbered regularly, and `foo' numbered as
+ USER_NUMBER_HAS_STRING_ALIAS. */
+#define USER_NUMBER_HAS_STRING_ALIAS -9991
+
+/* Undefined internal token number. */
+#define NUMBER_UNDEFINED (-1)
+
+/** Fetch (or create) the symbol associated to KEY. */
+symbol *symbol_from_uniqstr (const uniqstr key, location loc);
+
+/** Fetch (or create) the symbol associated to KEY. */
+symbol *symbol_get (const char *key, location loc);
+
+/** Generate a dummy nonterminal.
+
+ Its name cannot conflict with the user's names. */
+symbol *dummy_symbol_get (location loc);
+
+
+/*--------------------.
+| Methods on symbol. |
+`--------------------*/
+
+/** Print a symbol (for debugging). */
+void symbol_print (symbol const *s, FILE *f);
+
+/** Is this a dummy nonterminal? */
+bool symbol_is_dummy (const symbol *sym);
+
+/** The name of the code_props type: "\%destructor" or "\%printer". */
+char const *code_props_type_string (code_props_type kind);
+
+/** The name of the symbol that can be used as an identifier.
+ ** Consider the alias if needed.
+ ** Return 0 if there is none (e.g., the symbol is only defined as
+ ** a string). */
+uniqstr symbol_id_get (symbol const *sym);
+
+/**
+ * Make \c str the literal string alias of \c sym. Copy token number,
+ * symbol number, and type from \c sym to \c str.
+ */
+void symbol_make_alias (symbol *sym, symbol *str, location loc);
+
+/** Set the \c type_name associated with \c sym.
+
+ Do nothing if passed 0 as \c type_name. */
+void symbol_type_set (symbol *sym, uniqstr type_name, location loc);
+
+/** Set the \c \%destructor or \c \%printer associated with \c sym. */
+void symbol_code_props_set (symbol *sym, code_props_type kind,
+ code_props const *destructor);
+
+/** Get the computed \c \%destructor or \c %printer for \c sym, which was
+ initialized with \c code_props_none_init if there's no \c \%destructor or
+ \c %printer. */
+code_props *symbol_code_props_get (symbol *sym, code_props_type kind);
+
+/** Set the \c precedence associated with \c sym.
+
+ Ensure that \a symbol is a terminal.
+ Do nothing if invoked with \c undef_assoc as \c assoc. */
+void symbol_precedence_set (symbol *sym, int prec, assoc a, location loc);
+
+/** Set the \c class associated with \c sym. */
+void symbol_class_set (symbol *sym, symbol_class class, location loc,
+ bool declaring);
+
+/** Set the \c user_token_number associated with \c sym. */
+void symbol_user_token_number_set (symbol *sym, int user_number, location loc);
+
+
+
+/*------------------.
+| Special symbols. |
+`------------------*/
+
+/** The error token. */
+extern symbol *errtoken;
+/** The token for unknown tokens. */
+extern symbol *undeftoken;
+/** The end of input token. */
+extern symbol *endtoken;
+/** The genuine start symbol.
+
+ $accept: start-symbol $end */
+extern symbol *accept;
+
+/** The user start symbol. */
+extern symbol *startsymbol;
+/** The location of the \c \%start declaration. */
+extern location startsymbol_location;
+
+
+/*-----------------.
+| Semantic types. |
+`-----------------*/
+
+/** A semantic type and its associated \c \%destructor and \c \%printer.
+
+ Access the fields of this struct only through the interface functions in
+ this file. \sa symbol::destructor */
+typedef struct {
+ /** The key, name of the semantic type. */
+ uniqstr tag;
+
+ /** The location of its first occurence. */
+ location location;
+
+ /** Its status : "undeclared", "used" or "declared".
+ It cannot be "needed". */
+ status status;
+
+ /** Any \c %destructor and %printer declared for this
+ semantic type. */
+ code_props props[CODE_PROPS_SIZE];
+
+} semantic_type;
+
+/** Fetch (or create) the semantic type associated to KEY. */
+semantic_type *semantic_type_from_uniqstr (const uniqstr key,
+ const location *loc);
+
+/** Fetch (or create) the semantic type associated to KEY. */
+semantic_type *semantic_type_get (const char *key, const location *loc);
+
+/** Set the \c destructor or \c printer associated with \c type. */
+void semantic_type_code_props_set (semantic_type *type,
+ code_props_type kind,
+ code_props const *code);
+
+/*----------------------------------.
+| Symbol and semantic type tables. |
+`----------------------------------*/
+
+/** Create the symbol and semantic type tables. */
+void symbols_new (void);
+
+/** Free all the memory allocated for symbols and semantic types. */
+void symbols_free (void);