Berkeley YACC
1993-03-03
Berkeley's version of Yet Another Compiler Compiler
|
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
Go to the source code of this file.
Data Structures | |
struct | bucket |
struct | core |
struct | shifts |
struct | reductions |
struct | action |
Macros | |
#define | MAXCHAR 255 |
#define | MAXSHORT 32767 |
#define | MINSHORT -32768 |
#define | MAXTABLE 32500 |
#define | BITS_PER_WORD 32 |
#define | WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD) |
#define | BIT(r, n) ((((r)[(n)>>5])>>((n)&31))&1) |
#define | SETBIT(r, n) ((r)[(n)>>5]|=((unsigned)1<<((n)&31))) |
#define | NUL '\0' /* the null character */ |
#define | NEWLINE '\n' /* line feed */ |
#define | SP ' ' /* space */ |
#define | BS '\b' /* backspace */ |
#define | HT '\t' /* horizontal tab */ |
#define | VT '\013' /* vertical tab */ |
#define | CR '\r' /* carriage return */ |
#define | FF '\f' /* form feed */ |
#define | QUOTE '\'' /* single quote */ |
#define | DOUBLE_QUOTE '\"' /* double quote */ |
#define | BACKSLASH '\\' /* backslash */ |
#define | CODE_SUFFIX ".code.c" |
#define | DEFINES_SUFFIX ".tab.h" |
#define | OUTPUT_SUFFIX ".tab.c" |
#define | VERBOSE_SUFFIX ".output" |
#define | TOKEN 0 |
#define | LEFT 1 |
#define | RIGHT 2 |
#define | NONASSOC 3 |
#define | MARK 4 |
#define | TEXT 5 |
#define | TYPE 6 |
#define | START 7 |
#define | UNION 8 |
#define | IDENT 9 |
#define | UNKNOWN 0 |
#define | TERM 1 |
#define | NONTERM 2 |
#define | UNDEFINED (-1) |
#define | SHIFT 1 |
#define | REDUCE 2 |
#define | IS_IDENT(c) (isalnum(c) || (c) == '_' || (c) == '.' || (c) == '$') |
#define | IS_OCTAL(c) ((c) >= '0' && (c) <= '7') |
#define | NUMERIC_VALUE(c) ((c) - '0') |
#define | ISTOKEN(s) ((s) < start_symbol) |
#define | ISVAR(s) ((s) >= start_symbol) |
#define | CALLOC(k, n) (calloc((unsigned)(k),(unsigned)(n))) |
#define | FREE(x) (free((char*)(x))) |
#define | MALLOC(n) (malloc((unsigned)(n))) |
#define | NEW(t) ((t*)allocate(sizeof(t))) |
#define | NEW2(n, t) ((t*)allocate((unsigned)((n)*sizeof(t)))) |
#define | REALLOC(p, n) (realloc((char*)(p),(unsigned)(n))) |
Typedefs | |
typedef struct bucket | bucket |
typedef struct core | core |
typedef struct shifts | shifts |
typedef struct reductions | reductions |
typedef struct action | action |
Functions | |
char * | allocate () |
bucket * | lookup () |
bucket * | make_bucket () |
void | free () |
char * | calloc () |
char * | malloc () |
char * | realloc () |
char * | strcpy () |
Variables | |
char | dflag |
char | lflag |
char | rflag |
char | tflag |
char | vflag |
char * | symbol_prefix |
char * | myname |
char * | cptr |
char * | line |
int | lineno |
int | outline |
char * | banner [] |
char * | tables [] |
char * | header [] |
char * | body [] |
char * | trailer [] |
char * | action_file_name |
char * | code_file_name |
char * | defines_file_name |
char * | input_file_name |
char * | output_file_name |
char * | text_file_name |
char * | union_file_name |
char * | verbose_file_name |
FILE * | action_file |
FILE * | code_file |
FILE * | defines_file |
FILE * | input_file |
FILE * | output_file |
FILE * | text_file |
FILE * | union_file |
FILE * | verbose_file |
int | nitems |
int | nrules |
The number of rules in the grammar. More... | |
int | nsyms |
The number of symbols (terminals + non-terminals) in the grammar. More... | |
int | ntokens |
The number of tokens (terminals) in the grammar. More... | |
int | nvars |
The number of variables (non-terminals) in the grammar. More... | |
int | ntags |
char | unionized |
char | line_format [] |
int | start_symbol |
Index of the starting symbol of the grammar. More... | |
char ** | symbol_name |
Array of symbol names. More... | |
short * | symbol_value |
short * | symbol_prec |
char * | symbol_assoc |
short * | ritem |
Representation of all productions (and items) More... | |
short * | rlhs |
List of left-hand sides of all rules. More... | |
short * | rrhs |
List of right-hand sides of all rules. More... | |
short * | rprec |
char * | rassoc |
short ** | derives |
List of rules that derive each non-terminal. More... | |
char * | nullable |
bucket * | first_symbol |
bucket * | last_symbol |
int | nstates |
core * | first_state |
shifts * | first_shift |
reductions * | first_reduction |
short * | accessing_symbol |
core ** | state_table |
shifts ** | shift_table |
reductions ** | reduction_table |
unsigned * | LA |
short * | LAruleno |
short * | lookaheads |
short * | goto_map |
short * | from_state |
short * | to_state |
action ** | parser |
int | SRtotal |
int | RRtotal |
short * | SRconflicts |
short * | RRconflicts |
short * | defred |
short * | rules_used |
short | nunused |
short | final_state |
int | errno |
#define BIT | ( | r, | |
n | |||
) | ((((r)[(n)>>5])>>((n)&31))&1) |
Definition at line 27 of file defs.h.
Referenced by add_reductions().
#define BITS_PER_WORD 32 |
Definition at line 25 of file defs.h.
Referenced by closure(), reflexive_transitive_closure(), set_first_derives(), and transitive_closure().
#define CALLOC | ( | k, | |
n | |||
) | (calloc((unsigned)(k),(unsigned)(n))) |
Definition at line 101 of file defs.h.
Referenced by allocate().
#define CODE_SUFFIX ".code.c" |
Definition at line 48 of file defs.h.
Referenced by create_file_names().
#define DEFINES_SUFFIX ".tab.h" |
Definition at line 49 of file defs.h.
Referenced by create_file_names().
#define FREE | ( | x | ) | (free((char*)(x))) |
Definition at line 102 of file defs.h.
Referenced by build_relations(), compute_lookaheads(), copy_action(), copy_text(), copy_union(), digraph(), finalize_closure(), free_action_row(), free_derives(), free_itemsets(), free_nullable(), free_parser(), free_reductions(), free_shifts(), free_storage(), free_symbol_table(), free_symbols(), free_tags(), get_line(), get_literal(), get_tag(), goto_actions(), initialize_F(), output_actions(), output_base(), output_check(), output_debug(), output_table(), pack_grammar(), pack_names(), pack_symbols(), pack_table(), set_first_derives(), set_goto_map(), skip_comment(), token_actions(), transpose(), and verbose().
#define IDENT 9 |
Definition at line 65 of file defs.h.
Referenced by keyword(), and read_declarations().
#define IS_IDENT | ( | c | ) | (isalnum(c) || (c) == '_' || (c) == '.' || (c) == '$') |
Definition at line 88 of file defs.h.
Referenced by get_name(), get_tag(), and mark_symbol().
#define IS_OCTAL | ( | c | ) | ((c) >= '0' && (c) <= '7') |
Definition at line 89 of file defs.h.
Referenced by get_literal().
#define ISTOKEN | ( | s | ) | ((s) < start_symbol) |
Definition at line 95 of file defs.h.
Referenced by get_shifts(), and set_goto_map().
#define ISVAR | ( | s | ) | ((s) >= start_symbol) |
Definition at line 96 of file defs.h.
Referenced by build_relations(), closure(), initialize_F(), print_actions(), print_gotos(), and set_EFF().
#define LEFT 1 |
Definition at line 57 of file defs.h.
Referenced by keyword(), read_declarations(), and remove_conflicts().
#define MALLOC | ( | n | ) | (malloc((unsigned)(n))) |
Definition at line 103 of file defs.h.
Referenced by create_file_names(), create_symbol_table(), dup_line(), get_line(), get_literal(), get_tag(), initialize_grammar(), initialize_states(), make_bucket(), output_debug(), pack_grammar(), pack_names(), pack_symbols(), read_declarations(), set_nullable(), unused_rules(), and verbose().
#define MARK 4 |
Definition at line 60 of file defs.h.
Referenced by advance_to_start(), keyword(), and read_declarations().
#define MAXCHAR 255 |
Definition at line 21 of file defs.h.
Referenced by get_literal().
#define MAXSHORT 32767 |
Definition at line 22 of file defs.h.
Referenced by new_state(), set_goto_map(), and token_actions().
#define MAXTABLE 32500 |
Definition at line 24 of file defs.h.
Referenced by pack_vector().
#define NEW | ( | t | ) | ((t*)allocate(sizeof(t))) |
Definition at line 104 of file defs.h.
Referenced by add_lookback_edge(), add_reduce(), and get_shifts().
#define NEW2 | ( | n, | |
t | |||
) | ((t*)allocate((unsigned)((n)*sizeof(t)))) |
Definition at line 105 of file defs.h.
Referenced by allocate_itemsets(), allocate_storage(), build_relations(), defreds(), digraph(), generate_states(), goto_actions(), initialize_F(), initialize_LA(), make_parser(), output_actions(), pack_table(), remove_conflicts(), save_column(), set_accessing_symbol(), set_derives(), set_EFF(), set_first_derives(), set_goto_map(), set_reduction_table(), set_shift_table(), set_state_table(), sort_actions(), token_actions(), and transpose().
#define NONASSOC 3 |
Definition at line 59 of file defs.h.
Referenced by keyword(), and read_declarations().
#define NONTERM 2 |
Definition at line 72 of file defs.h.
Referenced by insert_empty_rule(), and start_rule().
#define NUL '\0' /* the null character */ |
Definition at line 33 of file defs.h.
Referenced by get_literal(), get_name(), get_tag(), is_reserved(), and keyword().
#define OUTPUT_SUFFIX ".tab.c" |
Definition at line 50 of file defs.h.
Referenced by create_file_names().
#define REALLOC | ( | p, | |
n | |||
) | (realloc((char*)(p),(unsigned)(n))) |
Definition at line 106 of file defs.h.
Referenced by cachec(), expand_items(), expand_rules(), get_line(), get_tag(), pack_grammar(), and pack_vector().
#define REDUCE 2 |
Definition at line 83 of file defs.h.
Referenced by add_reduce(), print_conflicts(), print_nulls(), print_reductions(), sole_reduction(), token_actions(), and unused_rules().
#define RIGHT 2 |
Definition at line 58 of file defs.h.
Referenced by keyword(), read_declarations(), and remove_conflicts().
#define SETBIT | ( | r, | |
n | |||
) | ((r)[(n)>>5]|=((unsigned)1<<((n)&31))) |
Definition at line 28 of file defs.h.
Referenced by initialize_F(), set_EFF(), and set_first_derives().
#define SHIFT 1 |
Definition at line 82 of file defs.h.
Referenced by add_reduce(), get_shifts(), print_conflicts(), print_shifts(), remove_conflicts(), sole_reduction(), and token_actions().
#define START 7 |
Definition at line 63 of file defs.h.
Referenced by advance_to_start(), keyword(), and read_declarations().
#define TERM 1 |
Definition at line 71 of file defs.h.
Referenced by advance_to_start(), check_symbols(), create_symbol_table(), declare_start(), declare_tokens(), get_literal(), pack_grammar(), pack_symbols(), and start_rule().
#define TEXT 5 |
Definition at line 61 of file defs.h.
Referenced by advance_to_start(), keyword(), and read_declarations().
#define TOKEN 0 |
Definition at line 56 of file defs.h.
Referenced by declare_tokens(), initialize_grammar(), insert_empty_rule(), keyword(), make_bucket(), pack_grammar(), pack_symbols(), read_declarations(), and start_rule().
#define TYPE 6 |
Definition at line 62 of file defs.h.
Referenced by keyword(), and read_declarations().
#define UNDEFINED (-1) |
Definition at line 77 of file defs.h.
Referenced by declare_tokens(), get_literal(), make_bucket(), mark_symbol(), pack_grammar(), pack_symbols(), and start_rule().
#define UNION 8 |
Definition at line 64 of file defs.h.
Referenced by keyword(), and read_declarations().
#define UNKNOWN 0 |
Definition at line 70 of file defs.h.
Referenced by check_symbols(), and make_bucket().
#define VERBOSE_SUFFIX ".output" |
Definition at line 51 of file defs.h.
Referenced by create_file_names().
#define WORDSIZE | ( | n | ) | (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD) |
Definition at line 26 of file defs.h.
Referenced by add_reductions(), closure(), finalize_closure(), generate_states(), lalr(), reflexive_transitive_closure(), set_EFF(), set_first_derives(), and transitive_closure().
typedef struct reductions reductions |
char* allocate | ( | ) |
Referenced by new_state(), save_reductions(), and save_shifts().
char* calloc | ( | ) |
void free | ( | ) |
bucket* lookup | ( | ) |
bucket* make_bucket | ( | ) |
char* malloc | ( | ) |
char* realloc | ( | ) |
char* strcpy | ( | ) |
Referenced by create_file_names(), get_tag(), make_bucket(), and pack_names().
short* accessing_symbol |
Definition at line 15 of file lalr.c.
Referenced by build_relations(), find_final_state(), get_shifts(), initialize_F(), output_actions(), print_actions(), print_gotos(), set_accessing_symbol(), and set_goto_map().
FILE* action_file |
Definition at line 27 of file main.c.
Referenced by copy_action(), done(), open_files(), and output_semantic_actions().
char* action_file_name |
Definition at line 18 of file main.c.
Referenced by create_file_names(), done(), open_files(), and output_semantic_actions().
char* banner[] |
Definition at line 15 of file skeleton.c.
Referenced by reader().
char* body[] |
Definition at line 77 of file skeleton.c.
Referenced by output().
FILE* code_file |
Definition at line 29 of file main.c.
Referenced by open_files(), output_debug(), output_defines(), output_prefix(), output_semantic_actions(), output_stored_text(), output_stype(), output_table(), output_trailing_text(), and write_section().
char* code_file_name |
Definition at line 19 of file main.c.
Referenced by create_file_names(), open_files(), output_semantic_actions(), output_stored_text(), and output_trailing_text().
char* cptr |
Definition at line 17 of file reader.c.
Referenced by add_symbol(), advance_to_start(), copy_action(), copy_ident(), copy_text(), copy_union(), declare_start(), declare_types(), get_line(), get_literal(), get_name(), get_number(), get_tag(), keyword(), mark_symbol(), nextc(), output_trailing_text(), read_declarations(), read_grammar(), and skip_comment().
FILE* defines_file |
Definition at line 30 of file main.c.
Referenced by open_files(), and output_defines().
char* defines_file_name |
Definition at line 20 of file main.c.
Referenced by create_file_names(), and open_files().
short* defred |
Definition at line 9 of file mkpar.c.
Referenced by defreds(), output_yydefred(), print_actions(), and token_actions().
short** derives |
List of rules that derive each non-terminal.
Array of pointers that associates to each symbol the list of productions that have it as the left-hand side. Each item in those lists is the identifying number of a rule. The first ntokens entries (the ones for terminals) are not set and should not be accessed. They are only present to make the indexes consistent with other arrays (i.e. this array can be indexed using the symbol number).
Allocated and filled in set_first_derives().
Definition at line 140 of file main.c.
Referenced by build_relations(), free_derives(), initialize_states(), set_derives(), set_EFF(), and set_first_derives().
char dflag |
Definition at line 4 of file main.c.
Referenced by copy_union(), create_file_names(), getargs(), open_files(), and output_defines().
int errno |
short final_state |
Definition at line 12 of file mkpar.c.
Referenced by find_final_state(), output_debug(), print_actions(), print_conflicts(), and remove_conflicts().
reductions* first_reduction |
Definition at line 11 of file lr0.c.
Referenced by free_reductions(), and set_reduction_table().
shifts* first_shift |
Definition at line 10 of file lr0.c.
Referenced by free_shifts(), set_goto_map(), and set_shift_table().
core* first_state |
Definition at line 9 of file lr0.c.
Referenced by free_itemsets(), set_accessing_symbol(), and set_state_table().
bucket* first_symbol |
Definition at line 11 of file symtab.c.
Referenced by check_symbols(), pack_names(), and pack_symbols().
short* from_state |
Definition at line 20 of file lalr.c.
Referenced by build_relations(), map_goto(), output_actions(), save_column(), and set_goto_map().
short* goto_map |
Definition at line 19 of file lalr.c.
Referenced by default_goto(), map_goto(), output_actions(), save_column(), and set_goto_map().
char* header[] |
Definition at line 49 of file skeleton.c.
Referenced by output().
FILE* input_file |
Definition at line 31 of file main.c.
Referenced by get_line(), getargs(), open_files(), and output_trailing_text().
char* input_file_name |
Definition at line 21 of file main.c.
Referenced by copy_action(), copy_text(), copy_union(), default_action_warning(), dollar_error(), dollar_warning(), getargs(), illegal_character(), illegal_tag(), no_grammar(), open_files(), output_trailing_text(), over_unionized(), prec_redeclared(), reprec_warning(), restarted_warning(), retyped_warning(), revalued_warning(), syntax_error(), terminal_lhs(), terminal_start(), tokenized_start(), unexpected_EOF(), unknown_rhs(), unterminated_action(), unterminated_comment(), unterminated_string(), unterminated_text(), unterminated_union(), untyped_lhs(), untyped_rhs(), and used_reserved().
unsigned* LA |
Definition at line 14 of file lalr.c.
Referenced by add_reductions(), compute_lookaheads(), initialize_LA(), and output_actions().
short* LAruleno |
Definition at line 13 of file lalr.c.
Referenced by add_lookback_edge(), add_reductions(), initialize_LA(), and output_actions().
bucket* last_symbol |
Definition at line 12 of file symtab.c.
Referenced by insert_empty_rule().
char lflag |
Definition at line 5 of file main.c.
Referenced by copy_action(), copy_text(), copy_union(), getargs(), output_semantic_actions(), output_stored_text(), and output_trailing_text().
char* line |
Definition at line 17 of file reader.c.
Referenced by advance_to_start(), copy_action(), copy_ident(), copy_text(), copy_union(), declare_start(), declare_types(), dup_line(), get_line(), get_literal(), get_tag(), illegal_character(), keyword(), mark_symbol(), nextc(), output_trailing_text(), over_unionized(), read_declarations(), read_grammar(), and skip_comment().
char line_format[] |
Definition at line 34 of file reader.c.
Referenced by copy_action(), copy_text(), copy_union(), output_semantic_actions(), output_stored_text(), and output_trailing_text().
int lineno |
Definition at line 15 of file main.c.
Referenced by add_symbol(), advance_to_start(), copy_action(), copy_ident(), copy_text(), copy_union(), declare_start(), declare_types(), default_action_warning(), get_line(), get_literal(), get_tag(), illegal_character(), keyword(), mark_symbol(), no_grammar(), output_trailing_text(), over_unionized(), prec_redeclared(), read_declarations(), read_grammar(), reprec_warning(), restarted_warning(), retyped_warning(), revalued_warning(), skip_comment(), terminal_start(), tokenized_start(), unexpected_EOF(), unknown_rhs(), untyped_lhs(), untyped_rhs(), and used_reserved().
short* lookaheads |
Definition at line 12 of file lalr.c.
Referenced by add_lookback_edge(), add_reductions(), compute_lookaheads(), initialize_LA(), and output_actions().
char* myname |
Definition at line 12 of file main.c.
Referenced by default_action_warning(), dollar_error(), dollar_warning(), fatal(), getargs(), illegal_character(), illegal_tag(), no_grammar(), no_space(), open_error(), over_unionized(), prec_redeclared(), reprec_warning(), restarted_warning(), retyped_warning(), revalued_warning(), syntax_error(), terminal_lhs(), terminal_start(), tokenized_start(), total_conflicts(), undefined_goal(), undefined_symbol_warning(), unexpected_EOF(), unknown_rhs(), unterminated_action(), unterminated_comment(), unterminated_string(), unterminated_text(), unterminated_union(), untyped_lhs(), untyped_rhs(), unused_rules(), usage(), and used_reserved().
int nitems |
Definition at line 40 of file main.c.
Referenced by add_symbol(), allocate_itemsets(), allocate_storage(), copy_action(), end_rule(), generate_states(), get_state(), initialize_grammar(), insert_empty_rule(), pack_grammar(), set_maxrhs(), set_nullable(), and show_ritems().
int nrules |
The number of rules in the grammar.
Definition at line 45 of file main.c.
Referenced by allocate_storage(), closure(), copy_action(), end_rule(), finalize_closure(), generate_states(), initialize_grammar(), insert_empty_rule(), log_unused(), mark_symbol(), output_debug(), output_rule_data(), pack_grammar(), print_grammar(), read_grammar(), set_derives(), set_first_derives(), show_rrhs(), start_rule(), unused_rules(), and verbose().
int nstates |
Definition at line 8 of file lr0.c.
Referenced by compute_lookaheads(), default_goto(), defreds(), free_parser(), goto_actions(), initialize_LA(), initialize_states(), log_conflicts(), make_parser(), matching_vector(), new_state(), output_actions(), output_base(), output_yydefred(), remove_conflicts(), save_column(), set_accessing_symbol(), set_reduction_table(), set_shift_table(), set_state_table(), token_actions(), unused_rules(), and verbose().
int nsyms |
The number of symbols (terminals + non-terminals) in the grammar.
All symbols can be uniquely represented using integers in the range [0, nsyms - 1], which is obtained by joining the range of terminals [0, ntokens - 1] with the range of non-terminals [ntokens, nsyms - 1].
It holds that nsyms = ntokens + nvars.
Definition at line 55 of file main.c.
Referenced by allocate_itemsets(), allocate_storage(), goto_actions(), new_itemsets(), pack_symbols(), set_derives(), set_EFF(), set_first_derives(), set_goto_map(), and set_nullable().
int ntags |
Definition at line 13 of file reader.c.
Referenced by copy_action(), free_tags(), get_tag(), and output_stype().
int ntokens |
The number of tokens (terminals) in the grammar.
All tokens can be uniquely represented using integers in the range [0, ntokens - 1].
It holds that nsyms = ntokens + nvars.
Definition at line 64 of file main.c.
Referenced by add_reductions(), finalize_closure(), lalr(), output_actions(), output_debug(), output_defines(), pack_symbols(), set_first_derives(), set_goto_map(), token_actions(), and verbose().
char* nullable |
Definition at line 141 of file main.c.
Referenced by build_relations(), free_nullable(), initialize_F(), and set_nullable().
short nunused |
Definition at line 11 of file mkpar.c.
Referenced by unused_rules(), and verbose().
int nvars |
The number of variables (non-terminals) in the grammar.
All variables can be uniquely represented using integers in the range [ntokens, nsyms - 1], which is equivalent to the range [ntokens, ntokens + nvars - 1].
It holds that nsyms = ntokens + nvars.
Definition at line 74 of file main.c.
Referenced by output_actions(), pack_symbols(), set_derives(), set_EFF(), set_first_derives(), set_goto_map(), and verbose().
int outline |
Definition at line 16 of file main.c.
Referenced by copy_ident(), goto_actions(), output_base(), output_check(), output_debug(), output_defines(), output_prefix(), output_rule_data(), output_semantic_actions(), output_stored_text(), output_stype(), output_table(), output_trailing_text(), output_yydefred(), and write_section().
FILE* output_file |
Definition at line 32 of file main.c.
Referenced by copy_ident(), goto_actions(), open_files(), output_base(), output_check(), output_debug(), output_rule_data(), output_table(), and output_yydefred().
char* output_file_name |
Definition at line 22 of file main.c.
Referenced by create_file_names(), and open_files().
action** parser |
Definition at line 4 of file mkpar.c.
Referenced by print_actions(), print_conflicts(), print_nulls(), and token_actions().
char* rassoc |
Definition at line 128 of file main.c.
Referenced by add_reduce(), expand_rules(), initialize_grammar(), insert_empty_rule(), mark_symbol(), pack_grammar(), and start_rule().
reductions** reduction_table |
Definition at line 18 of file lalr.c.
Referenced by free_reductions().
char rflag |
Definition at line 6 of file main.c.
Referenced by create_file_names(), getargs(), goto_actions(), open_files(), output(), output_base(), output_check(), output_debug(), output_rule_data(), output_table(), and output_yydefred().
short* ritem |
Representation of all productions (and items)
Typical shape: [1, 12, 21, -1, 2, 3, -2, 1, 4, -3, ...]
All productions are represented in this array as the list of their right-hand side symbols followed by the negation of their index. So the symbols on the right-hand side of the first rule are followed by -1, then there are the right-hand side symbols of the second rule and then -2, and so on.
Indices (using short integers) inside this array can represent rules (in that case they point to the first element after a negative one) or items, in which case they can point to any position; the element in that position is taken to be the first element after the "point" of the item. If the index points to a negative number, then it represents a reduction item for the rule whose number is the absolute value of the pointed element.
The array called rrhs contains indices inside this list and is used to associate to each rule the beginning of its production (that is, the closure item for that rule).
Definition at line 112 of file main.c.
Referenced by allocate_itemsets(), build_relations(), closure(), find_final_state(), log_unused(), new_itemsets(), output_debug(), pack_grammar(), print_core(), print_grammar(), save_reductions(), set_EFF(), set_maxrhs(), set_nullable(), show_cores(), and show_ritems().
short* rlhs |
List of left-hand sides of all rules.
This array associates to each production its left-hand side symbol.
Definition at line 119 of file main.c.
Referenced by log_unused(), output_debug(), output_rule_data(), pack_grammar(), print_core(), print_grammar(), print_nulls(), set_derives(), set_nullable(), and show_cores().
short* rprec |
Definition at line 127 of file main.c.
Referenced by add_reduce(), expand_rules(), initialize_grammar(), insert_empty_rule(), mark_symbol(), pack_grammar(), and start_rule().
short* RRconflicts |
Definition at line 8 of file mkpar.c.
Referenced by log_conflicts(), print_state(), and remove_conflicts().
short* rrhs |
List of right-hand sides of all rules.
Array of indices inside ritem. It is used record the position inside ritem where each rule begins.
Definition at line 126 of file main.c.
Referenced by build_relations(), closure(), initialize_states(), log_unused(), output_debug(), output_rule_data(), pack_grammar(), print_core(), print_nulls(), set_EFF(), show_cores(), and show_rrhs().
int RRtotal |
Definition at line 6 of file mkpar.c.
Referenced by make_parser(), remove_conflicts(), total_conflicts(), and verbose().
short* rules_used |
Definition at line 10 of file mkpar.c.
Referenced by log_unused(), and unused_rules().
shifts** shift_table |
Definition at line 17 of file lalr.c.
Referenced by find_final_state(), free_shifts(), get_shifts(), print_actions(), and print_gotos().
short* SRconflicts |
Definition at line 7 of file mkpar.c.
Referenced by log_conflicts(), print_state(), and remove_conflicts().
int SRtotal |
Definition at line 5 of file mkpar.c.
Referenced by make_parser(), remove_conflicts(), total_conflicts(), and verbose().
int start_symbol |
Index of the starting symbol of the grammar.
It holds that start_symbol = ntokens. In fact, the starting symbol is always placed at the beginning of the non-terminal range [ntokens, nsyms - 1].
Definition at line 82 of file main.c.
Referenced by free_derives(), goto_actions(), initialize_states(), output_rule_data(), pack_grammar(), pack_symbols(), set_derives(), set_EFF(), and set_first_derives().
core** state_table |
Definition at line 16 of file lalr.c.
Referenced by free_itemsets(), and print_core().
char* symbol_assoc |
Definition at line 93 of file main.c.
Referenced by get_shifts(), and pack_symbols().
char** symbol_name |
Array of symbol names.
Array of strings representing the names of all symbols. All names are allocated in a single contiguous block of memory to improve locality.
Definition at line 90 of file main.c.
Referenced by log_unused(), output_debug(), output_defines(), pack_symbols(), print_conflicts(), print_core(), print_gotos(), print_grammar(), print_nulls(), print_reductions(), print_shifts(), set_nullable(), and show_cores().
short* symbol_prec |
Definition at line 92 of file main.c.
Referenced by get_shifts(), and pack_symbols().
char* symbol_prefix |
Definition at line 10 of file main.c.
Referenced by getargs(), goto_actions(), output_base(), output_check(), output_debug(), output_defines(), output_prefix(), output_rule_data(), output_table(), and output_yydefred().
short* symbol_value |
Definition at line 91 of file main.c.
Referenced by output_debug(), output_defines(), output_rule_data(), pack_symbols(), save_column(), and token_actions().
char* tables[] |
Definition at line 30 of file skeleton.c.
Referenced by output().
FILE* text_file |
Definition at line 33 of file main.c.
Referenced by copy_text(), copy_union(), done(), open_files(), and output_stored_text().
char* text_file_name |
Definition at line 23 of file main.c.
Referenced by create_file_names(), done(), open_files(), and output_stored_text().
char tflag |
Definition at line 7 of file main.c.
Referenced by getargs(), and output_debug().
short* to_state |
Definition at line 21 of file lalr.c.
Referenced by build_relations(), default_goto(), find_final_state(), get_shifts(), initialize_F(), output_actions(), print_gotos(), save_column(), and set_goto_map().
char* trailer[] |
Definition at line 225 of file skeleton.c.
Referenced by output().
FILE* union_file |
Definition at line 35 of file main.c.
Referenced by copy_union(), done(), open_files(), and output_defines().
char* union_file_name |
Definition at line 24 of file main.c.
Referenced by create_file_names(), done(), open_files(), and output_defines().
char unionized |
Definition at line 16 of file reader.c.
Referenced by copy_union(), output_defines(), and output_stype().
FILE* verbose_file |
Definition at line 38 of file main.c.
Referenced by log_conflicts(), log_unused(), open_files(), print_actions(), print_conflicts(), print_core(), print_gotos(), print_grammar(), print_nulls(), print_reductions(), print_shifts(), print_state(), and verbose().
char* verbose_file_name |
Definition at line 25 of file main.c.
Referenced by create_file_names(), and open_files().
char vflag |
Definition at line 8 of file main.c.
Referenced by create_file_names(), getargs(), open_files(), print_grammar(), and verbose().