mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
* doc/Doxyfile.in: New.
* doc/Makefile.am: Use it. * src/lalr.h, src/symtab.h: Initial doxygenation.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2006-06-27 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* doc/Doxyfile.in: New.
|
||||||
|
* doc/Makefile.am: Use it.
|
||||||
|
* src/lalr.h, src/symtab.h: Initial doxygenation.
|
||||||
|
|
||||||
2006-06-26 Joel E. Denny <jdenny@ces.clemson.edu>
|
2006-06-26 Joel E. Denny <jdenny@ces.clemson.edu>
|
||||||
|
|
||||||
Don't miss %merge result type warnings just because the LHS types are
|
Don't miss %merge result type warnings just because the LHS types are
|
||||||
|
|||||||
1087
doc/Doxyfile.in
Normal file
1087
doc/Doxyfile.in
Normal file
File diff suppressed because it is too large
Load Diff
@@ -24,11 +24,44 @@ bison_TEXINFOS = gpl.texi fdl.texi
|
|||||||
EXTRA_DIST = bison.1 refcard.tex
|
EXTRA_DIST = bison.1 refcard.tex
|
||||||
|
|
||||||
CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns
|
CLEANFILES = refcard.dvi refcard.log refcard.ps bison.fns
|
||||||
|
CLEANDIRS = *.t2d
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -rf *.t2d
|
rm -rf $(CLEANDIRS)
|
||||||
|
|
||||||
refcard.dvi: refcard.tex
|
refcard.dvi: refcard.tex
|
||||||
tex refcard.tex
|
tex refcard.tex
|
||||||
|
|
||||||
refcard.ps: refcard.dvi
|
refcard.ps: refcard.dvi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Doxygenation. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
DOXYGEN = doxygen
|
||||||
|
|
||||||
|
.PHONY: doc html
|
||||||
|
|
||||||
|
doc: html
|
||||||
|
|
||||||
|
html-local: Doxyfile
|
||||||
|
$(DOXYGEN)
|
||||||
|
|
||||||
|
edit = sed -e "s|@ID@|$$Id|" \
|
||||||
|
-e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
||||||
|
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
||||||
|
-e 's,@top_builddir\@,$(top_builddir),g' \
|
||||||
|
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
||||||
|
|
||||||
|
EXTRA_DIST += Doxyfile.in
|
||||||
|
CLEANFILES += Doxyfile
|
||||||
|
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
||||||
|
# configure, because the former is way faster than the latter.
|
||||||
|
# Moreover, this file is updated whenever ChangeLog is touched: using
|
||||||
|
# sed instead of configure saves us a lot of time.
|
||||||
|
Doxyfile: $(top_srcdir)/ChangeLog $(srcdir)/Doxyfile.in
|
||||||
|
Id=`grep '^\$$Id' $(top_srcdir)/ChangeLog`; \
|
||||||
|
$(edit) $(srcdir)/Doxyfile.in >Doxyfile
|
||||||
|
|
||||||
|
CLEANDIRS += html latex
|
||||||
|
|||||||
42
src/lalr.h
42
src/lalr.h
@@ -1,6 +1,6 @@
|
|||||||
/* Compute lookahead criteria for bison,
|
/* Compute lookahead criteria for bison,
|
||||||
|
|
||||||
Copyright (C) 1984, 1986, 1989, 2000, 2002, 2004 Free Software
|
Copyright (C) 1984, 1986, 1989, 2000, 2002, 2004, 2006 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
@@ -32,35 +32,41 @@
|
|||||||
/* Import the definition of CORE, TRANSITIONS and REDUCTIONS. */
|
/* Import the definition of CORE, TRANSITIONS and REDUCTIONS. */
|
||||||
# include "state.h"
|
# include "state.h"
|
||||||
|
|
||||||
/* Compute how to make the finite state machine deterministic; find
|
|
||||||
which rules need lookahead in each state, and which lookahead
|
|
||||||
tokens they accept. */
|
|
||||||
|
|
||||||
|
/** Build the LALR(1) automaton.
|
||||||
|
|
||||||
|
Compute how to make the finite state machine deterministic; find
|
||||||
|
which rules need lookahead in each state, and which lookahead
|
||||||
|
tokens they accept.
|
||||||
|
|
||||||
|
Builds:
|
||||||
|
- #goto_map
|
||||||
|
- #from_state
|
||||||
|
- #to_state
|
||||||
|
*/
|
||||||
void lalr (void);
|
void lalr (void);
|
||||||
|
|
||||||
/* Release the information related to lookahead tokens. Can be performed
|
|
||||||
once the action tables are computed. */
|
|
||||||
|
|
||||||
|
/** Release the information related to lookahead tokens.
|
||||||
|
|
||||||
|
Can be performed once the action tables are computed. */
|
||||||
void lalr_free (void);
|
void lalr_free (void);
|
||||||
|
|
||||||
|
|
||||||
/* lalr() builds these data structures. */
|
|
||||||
|
|
||||||
/* GOTO_MAP, FROM_STATE and TO_STATE -- record each shift transition
|
|
||||||
which accepts a variable (a nonterminal).
|
|
||||||
|
|
||||||
FROM_STATE[T] -- state number which a transition leads from.
|
|
||||||
TO_STATE[T] -- state number it leads to.
|
|
||||||
|
|
||||||
All the transitions that accept a particular variable are grouped
|
|
||||||
together and GOTO_MAP[I - NTOKENS] is the index in FROM_STATE and
|
|
||||||
TO_STATE of the first of them. */
|
|
||||||
|
|
||||||
typedef size_t goto_number;
|
typedef size_t goto_number;
|
||||||
# define GOTO_NUMBER_MAXIMUM ((goto_number) -1)
|
# define GOTO_NUMBER_MAXIMUM ((goto_number) -1)
|
||||||
|
|
||||||
|
/** Index into #from_state and #to_state.
|
||||||
|
|
||||||
|
All the transitions that accept a particular variable are grouped
|
||||||
|
together and GOTO_MAP[I - NTOKENS] is the index in FROM_STATE and
|
||||||
|
TO_STATE of the first of them. */
|
||||||
extern goto_number *goto_map;
|
extern goto_number *goto_map;
|
||||||
|
|
||||||
|
/** State number which a transition leads from. */
|
||||||
extern state_number *from_state;
|
extern state_number *from_state;
|
||||||
|
|
||||||
|
/** State number it leads to. */
|
||||||
extern state_number *to_state;
|
extern state_number *to_state;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
87
src/symtab.h
87
src/symtab.h
@@ -20,6 +20,11 @@
|
|||||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02110-1301, USA. */
|
Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file symtab.h
|
||||||
|
* \brief Manipulating ::symbol.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef SYMTAB_H_
|
#ifndef SYMTAB_H_
|
||||||
# define SYMTAB_H_
|
# define SYMTAB_H_
|
||||||
|
|
||||||
@@ -31,16 +36,16 @@
|
|||||||
| Symbols. |
|
| Symbols. |
|
||||||
`----------*/
|
`----------*/
|
||||||
|
|
||||||
/* Symbol classes. */
|
/** Symbol classes. */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
unknown_sym,
|
unknown_sym, /**< Undefined. */
|
||||||
token_sym, /* terminal symbol */
|
token_sym, /**< Terminal. */
|
||||||
nterm_sym /* non-terminal */
|
nterm_sym /**< Non-terminal. */
|
||||||
} symbol_class;
|
} symbol_class;
|
||||||
|
|
||||||
|
|
||||||
/* Internal token numbers. */
|
/** Internal token numbers. */
|
||||||
typedef int symbol_number;
|
typedef int symbol_number;
|
||||||
#define SYMBOL_NUMBER_MAXIMUM INT_MAX
|
#define SYMBOL_NUMBER_MAXIMUM INT_MAX
|
||||||
|
|
||||||
@@ -51,20 +56,20 @@ typedef struct symbol symbol;
|
|||||||
symbol_check_alias_consistency. */
|
symbol_check_alias_consistency. */
|
||||||
struct symbol
|
struct symbol
|
||||||
{
|
{
|
||||||
/* The key, name of the symbol. */
|
/** The key, name of the symbol. */
|
||||||
uniqstr tag;
|
uniqstr tag;
|
||||||
/* The location of its first occurrence. */
|
/** The location of its first occurrence. */
|
||||||
location location;
|
location location;
|
||||||
|
|
||||||
/* Its %type and associated printer and destructor. */
|
/** Its %type and associated printer and destructor. */
|
||||||
uniqstr type_name;
|
uniqstr type_name;
|
||||||
location type_location;
|
location type_location;
|
||||||
|
|
||||||
/* Does not own the memory. */
|
/** Does not own the memory. */
|
||||||
const char *destructor;
|
const char *destructor;
|
||||||
location destructor_location;
|
location destructor_location;
|
||||||
|
|
||||||
/* Printer. */
|
/** Printer. */
|
||||||
const char *printer;
|
const char *printer;
|
||||||
location printer_location;
|
location printer_location;
|
||||||
|
|
||||||
@@ -82,7 +87,8 @@ struct symbol
|
|||||||
bool declared;
|
bool declared;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Undefined user number. */
|
|
||||||
|
/** Undefined user number. */
|
||||||
#define USER_NUMBER_UNDEFINED -1
|
#define USER_NUMBER_UNDEFINED -1
|
||||||
|
|
||||||
/* `symbol->user_token_number == USER_NUMBER_ALIAS' means this symbol
|
/* `symbol->user_token_number == USER_NUMBER_ALIAS' means this symbol
|
||||||
@@ -94,52 +100,62 @@ struct symbol
|
|||||||
/* Undefined internal token number. */
|
/* Undefined internal token number. */
|
||||||
#define NUMBER_UNDEFINED (-1)
|
#define NUMBER_UNDEFINED (-1)
|
||||||
|
|
||||||
/* Print a symbol (for debugging). */
|
/** Print a symbol (for debugging). */
|
||||||
void symbol_print (symbol *s, FILE *f);
|
void symbol_print (symbol *s, FILE *f);
|
||||||
|
|
||||||
/* Fetch (or create) the symbol associated to KEY. */
|
/** Fetch (or create) the symbol associated to KEY. */
|
||||||
symbol *symbol_from_uniqstr (const uniqstr key, location loc);
|
symbol *symbol_from_uniqstr (const uniqstr key, location loc);
|
||||||
|
|
||||||
/* Fetch (or create) the symbol associated to KEY. */
|
/** Fetch (or create) the symbol associated to KEY. */
|
||||||
symbol *symbol_get (const char *key, location loc);
|
symbol *symbol_get (const char *key, location loc);
|
||||||
|
|
||||||
/* Generate a dummy nonterminal, whose name cannot conflict with the
|
/** Generate a dummy nonterminal.
|
||||||
user's names. */
|
|
||||||
|
Its name cannot conflict with the user's names. */
|
||||||
symbol *dummy_symbol_get (location loc);
|
symbol *dummy_symbol_get (location loc);
|
||||||
|
|
||||||
/* Declare the new symbol SYM. Make it an alias of SYMVAL. */
|
/** Declare the new symbol \c sym. Make it an alias of \c symval. */
|
||||||
void symbol_make_alias (symbol *sym, symbol *symval, location loc);
|
void symbol_make_alias (symbol *sym, symbol *symval, location loc);
|
||||||
|
|
||||||
/* Set the TYPE_NAME associated with SYM. Do nothing if passed 0 as
|
/** Set the \c type_name associated with \c sym.
|
||||||
TYPE_NAME. */
|
|
||||||
|
Do nothing if passed 0 as \c type_name. */
|
||||||
void symbol_type_set (symbol *sym, uniqstr type_name, location loc);
|
void symbol_type_set (symbol *sym, uniqstr type_name, location loc);
|
||||||
|
|
||||||
/* Set the DESTRUCTOR associated with SYM. */
|
/** Set the \c destructor associated with \c sym. */
|
||||||
void symbol_destructor_set (symbol *sym, const char *destructor, location loc);
|
void symbol_destructor_set (symbol *sym, const char *destructor, location loc);
|
||||||
|
|
||||||
/* Set the PRINTER associated with SYM. */
|
/** Set the \c printer associated with \c sym. */
|
||||||
void symbol_printer_set (symbol *sym, const char *printer, location loc);
|
void symbol_printer_set (symbol *sym, const char *printer, location loc);
|
||||||
|
|
||||||
/* Set the PRECEDENCE associated with SYM. Ensure that SYMBOL is a
|
/* Set the \c precedence associated with \c sym.
|
||||||
terminal. Do nothing if invoked with UNDEF_ASSOC as ASSOC. */
|
|
||||||
|
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);
|
void symbol_precedence_set (symbol *sym, int prec, assoc a, location loc);
|
||||||
|
|
||||||
/* Set the CLASS associated with SYM. */
|
/** Set the \c class associated with \c sym. */
|
||||||
void symbol_class_set (symbol *sym, symbol_class class, location loc,
|
void symbol_class_set (symbol *sym, symbol_class class, location loc,
|
||||||
bool declaring);
|
bool declaring);
|
||||||
|
|
||||||
/* Set the USER_TOKEN_NUMBER associated with SYM. */
|
/** Set the \c user_token_number associated with \c sym. */
|
||||||
void symbol_user_token_number_set (symbol *sym, int user_number, location loc);
|
void symbol_user_token_number_set (symbol *sym, int user_number, location loc);
|
||||||
|
|
||||||
|
|
||||||
/* Distinguished symbols. AXIOM is the real start symbol, that used
|
/** The error token. */
|
||||||
by the automaton. STARTSYMBOL is the one specified by the user.
|
|
||||||
*/
|
|
||||||
extern symbol *errtoken;
|
extern symbol *errtoken;
|
||||||
|
/** The token for unknown tokens. */
|
||||||
extern symbol *undeftoken;
|
extern symbol *undeftoken;
|
||||||
|
/** The end of input token. */
|
||||||
extern symbol *endtoken;
|
extern symbol *endtoken;
|
||||||
|
/** The genuine start symbol.
|
||||||
|
|
||||||
|
$accept: start-symbol $end */
|
||||||
extern symbol *accept;
|
extern symbol *accept;
|
||||||
|
|
||||||
|
/** The user start symbol. */
|
||||||
extern symbol *startsymbol;
|
extern symbol *startsymbol;
|
||||||
|
/** The location of the \c %start declaration. */
|
||||||
extern location startsymbol_location;
|
extern location startsymbol_location;
|
||||||
|
|
||||||
|
|
||||||
@@ -148,18 +164,21 @@ extern location startsymbol_location;
|
|||||||
`---------------*/
|
`---------------*/
|
||||||
|
|
||||||
|
|
||||||
/* Create the symbol table. */
|
/** Create the symbol table. */
|
||||||
void symbols_new (void);
|
void symbols_new (void);
|
||||||
|
|
||||||
/* Free all the memory allocated for symbols. */
|
/** Free all the memory allocated for symbols. */
|
||||||
void symbols_free (void);
|
void symbols_free (void);
|
||||||
|
|
||||||
/* Check that all the symbols are defined. Report any undefined
|
/** Check that all the symbols are defined.
|
||||||
symbols and consider them nonterminals. */
|
|
||||||
|
Report any undefined symbols and consider them nonterminals. */
|
||||||
void symbols_check_defined (void);
|
void symbols_check_defined (void);
|
||||||
|
|
||||||
/* Perform various sanity checks, assign symbol numbers, and set up
|
/** Sanity checks and #token_translations construction.
|
||||||
TOKEN_TRANSLATIONS. */
|
|
||||||
|
Perform various sanity checks, assign symbol numbers, and set up
|
||||||
|
#token_translations. */
|
||||||
void symbols_pack (void);
|
void symbols_pack (void);
|
||||||
|
|
||||||
#endif /* !SYMTAB_H_ */
|
#endif /* !SYMTAB_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user