#include "sxversion.h"
#include "sxcommon.h"
#include <stdio.h>
#include "sxnd.h"
Go to the source code of this file.
Defines | |
#define | stdout_or_NULL stdout |
#define | PUSH(T, x) T [x] = T [0], T [0] = x |
#define | POP(T, x) x = T [0], T [0] = T [x], T [x] = 0 |
#define | Commun 1 |
#define | Propre 2 |
#define | Defaut 3 |
#define | Done 4 |
Functions | |
SXVOID | output_repair_list (void) |
SXVOID | output_repair_string (SXINT output_repair_string_index) |
SXVOID | sxndparser_GC (SXINT current_parser) |
static SXVOID | parsers_oflw (SXINT old_size, SXINT new_size) |
static SXVOID | sons_oflw (SXINT old_size, SXINT new_size) |
static SXVOID | symbols_oflw (SXINT old_size, SXINT new_size) |
static SXBOOLEAN | set_next_item (struct SXP_item *vector, SXINT *check, SXINT *action, SXINT Max) |
SXVOID | set_first_trans (struct SXP_bases *abase, SXINT *check, SXINT *action, SXINT Max, SXINT *next_action_kind) |
SXBOOLEAN | set_next_trans (struct SXP_bases *abase, SXINT *check, SXINT *action, SXINT Max, SXINT *next_action_kind) |
SXINT | NDP_access (struct SXP_bases *abase, SXINT j) |
SXBOOLEAN | new_symbol (SXINT reduce, SXINT k, SXINT i, SXINT j, SXINT *symbol) |
void | set_rule (SXINT lhs, SXINT rhs) |
static SXINT | build_a_rule (SXINT parser, SXINT build_a_rule_index, SXINT rhs) |
SXVOID | set_start_symbol (SXINT symbol) |
static SXVOID | clear_triples (void) |
SXINT | mreds_push (SXINT parser, SXINT ref, SXINT tok_no, SXBOOLEAN is_new_triple, SXBOOLEAN is_shift_reduce, SXINT symbol) |
SXINT | new_parser (SXINT son, SXINT state, SXINT symbol) |
static SXBOOLEAN | call_predicate (SXINT current_token, SXINT prdct) |
static SXINT | ARC_traversal (SXINT ref) |
static void | create_ref (SXINT father, SXINT ref) |
SXBOOLEAN | sxndsubparse_a_token (SXINT parser, SXINT ref, SXINT symbol, SXINT(*f)(SXINT, SXINT, SXINT)) |
static SXBOOLEAN | do_reductions (SXINT son, SXBOOLEAN is_in_set) |
static SXBOOLEAN | do_pops (SXINT p, SXINT l) |
static SXVOID | seek_paths (SXINT p, SXINT p_trans, SXBOOLEAN is_in_set, SXINT l) |
static SXBOOLEAN | do_limited_pops (SXINT p, SXINT l) |
static SXVOID | parse_forest (void) |
static void | single_reduce (SXINT xtriple, SXBOOLEAN is_limited) |
SXVOID | reducer (void) |
static SXVOID | grammar_new_rule (SXINT lhs) |
static SXVOID | grammar_put (SXINT symbol) |
static SXVOID | push_new_nt (SXINT symbol) |
static SXVOID | expand_rule (SXINT tnt) |
static SXVOID | hook_construction (SXINT symbol) |
static SXVOID | unused_rule_elimination (void) |
static SXVOID | output_rule (SXINT rule) |
static SXVOID | output_grammar (void) |
static SXVOID | do_put_error (void) |
static SXVOID | sxndparse_it (void) |
static SXBOOLEAN | dag_set (SXINT dag_set_index, SXINT succ_kind, SXINT new_kind) |
static SXBOOLEAN | sxnd2_error_detected (void) |
static SXVOID | sxnd2parse_it (void) |
static SXBOOLEAN | sxnddesambig_it (void) |
void | sxndparse_erase_hook_item (SXINT item) |
SXBOOLEAN | sxndparse_clean_forest (void) |
void | sxndparse_pack_forest (void) |
SXBOOLEAN | sxndparser (SXINT what_to_do, struct sxtables *arg) |
SXBOOLEAN | sxnd2parser (SXINT what_to_do, struct sxtables *arg) |
SXBOOLEAN | sxndparse_in_la (SXINT ep_la, SXINT Ttok_no, SXINT *Htok_no, struct sxparse_mode *mode_ptr) |
Variables | |
static char | ME [] = "NDPARSER" |
char | WHAT_SXNDPARSER32 [] = "@(#)SYNTAX - $Id: sxndparser.c 1491 2008-07-23 16:13:15Z sagot $ SXNDPARSER_32" WHAT_DEBUG |
static SXINT * | rhs_stack |
static SXINT * | symbol_stack |
static SXINT * | symb_to_rule_hd |
static SXINT * | symb_to_rule_list |
static SXBA | hook_symbol_set |
#define Commun 1 |
Definition at line 65 of file sxndparser.c.
#define Defaut 3 |
Definition at line 67 of file sxndparser.c.
#define Done 4 |
Definition at line 68 of file sxndparser.c.
Definition at line 59 of file sxndparser.c.
#define Propre 2 |
Definition at line 66 of file sxndparser.c.
#define stdout_or_NULL stdout |
Definition at line 44 of file sxndparser.c.
static SXINT ARC_traversal | ( | SXINT | ref | ) | [static] |
Definition at line 723 of file sxndparser.c.
References ARC_traversal(), call_predicate(), NDP_access(), sxget_token(), and sxplocals.
static SXINT build_a_rule | ( | SXINT | parser, | |
SXINT | build_a_rule_index, | |||
SXINT | rhs | |||
) | [static] |
Definition at line 480 of file sxndparser.c.
References ME, new_symbol(), set_rule(), SXBOOLEAN, and sxtrap().
Referenced by parse_forest(), and seek_paths().
static SXBOOLEAN call_predicate | ( | SXINT | current_token, | |
SXINT | prdct | |||
) | [static] |
Definition at line 710 of file sxndparser.c.
References SXBOOLEAN, and sxplocals.
Referenced by ARC_traversal().
static SXVOID clear_triples | ( | void | ) | [static] |
Definition at line 520 of file sxndparser.c.
Referenced by reducer().
static void create_ref | ( | SXINT | father, | |
SXINT | ref | |||
) | [static] |
Definition at line 800 of file sxndparser.c.
References ARC_traversal(), ME, mreds_push(), SXBOOLEAN, SXFALSE, sxplocals, sxtrap(), SXTRUE, and XxY_set().
Referenced by sxndparse_in_la(), sxndparser(), and sxndsubparse_a_token().
static SXBOOLEAN dag_set | ( | SXINT | dag_set_index, | |
SXINT | succ_kind, | |||
SXINT | new_kind | |||
) | [static] |
Definition at line 2846 of file sxndparser.c.
References ME, SXBOOLEAN, SXFALSE, sxtrap(), and SXTRUE.
Referenced by sxnd2parse_it().
static SXBOOLEAN do_limited_pops | ( | SXINT | p, | |
SXINT | l | |||
) | [static] |
Definition at line 1286 of file sxndparser.c.
References do_reductions(), son, sxba_scan(), sxba_scan_reset(), SXBOOLEAN, SXFALSE, and SXTRUE.
Referenced by single_reduce().
static SXBOOLEAN do_pops | ( | SXINT | p, | |
SXINT | l | |||
) | [static] |
Definition at line 1169 of file sxndparser.c.
References do_reductions(), son, sxba_scan_reset(), SXBOOLEAN, SXFALSE, and SXTRUE.
Referenced by single_reduce().
static SXVOID do_put_error | ( | void | ) | [static] |
Definition at line 2635 of file sxndparser.c.
References output_repair_string(), SXBOOLEAN, SXFALSE, and SXTRUE.
Referenced by one_correction_message(), and sxnddesambig_it().
static SXBOOLEAN do_reductions | ( | SXINT | son, | |
SXBOOLEAN | is_in_set | |||
) | [static] |
Definition at line 1011 of file sxndparser.c.
References ME, NDP_access(), new_symbol(), sxba_scan_reset(), SXBOOLEAN, SXFALSE, sxndsubparse_a_token(), sxplocals, sxtrap(), and SXTRUE.
Referenced by do_limited_pops(), and do_pops().
static SXVOID expand_rule | ( | SXINT | tnt | ) | [static] |
Definition at line 1980 of file sxndparser.c.
References grammar_new_rule(), grammar_put(), push_new_nt(), rhs_stack, and sxplocals.
Referenced by unused_rule_elimination().
static SXVOID grammar_new_rule | ( | SXINT | lhs | ) | [static] |
Definition at line 1902 of file sxndparser.c.
References symb_to_rule_hd, and symb_to_rule_list.
Referenced by expand_rule(), hook_construction(), and unused_rule_elimination().
static SXVOID grammar_put | ( | SXINT | symbol | ) | [static] |
Definition at line 1925 of file sxndparser.c.
Referenced by expand_rule(), hook_construction(), and unused_rule_elimination().
static SXVOID hook_construction | ( | SXINT | symbol | ) | [static] |
Definition at line 2043 of file sxndparser.c.
References grammar_new_rule(), grammar_put(), ME, sxtrap(), symb_to_rule_hd, and symb_to_rule_list.
Referenced by unused_rule_elimination().
SXINT mreds_push | ( | SXINT | parser, | |
SXINT | ref, | |||
SXINT | tok_no, | |||
SXBOOLEAN | is_new_triple, | |||
SXBOOLEAN | is_shift_reduce, | |||
SXINT | symbol | |||
) |
SXINT NDP_access | ( | struct SXP_bases * | abase, | |
SXINT | j | |||
) |
Definition at line 376 of file sxndparser.c.
SXINT new_parser | ( | SXINT | son, | |
SXINT | state, | |||
SXINT | symbol | |||
) |
Definition at line 609 of file sxndparser.c.
References ME, reduce(), SXBOOLEAN, SXFALSE, sxndparser_GC(), sxplocals, sxtrap(), SXTRUE, XxY_set(), and XxYxZ_set().
Referenced by clone(), set_next_shift_state(), sxndparse_in_la(), sxndparser(), and sxndsubparse_a_token().
SXBOOLEAN new_symbol | ( | SXINT | reduce, | |
SXINT | k, | |||
SXINT | i, | |||
SXINT | j, | |||
SXINT * | symbol | |||
) |
Definition at line 403 of file sxndparser.c.
References ME, sxplocals, sxtrap(), and XxY_set().
Referenced by build_a_rule(), do_reductions(), and set_start_symbol().
static SXVOID output_grammar | ( | void | ) | [static] |
Definition at line 2615 of file sxndparser.c.
References output_rule().
Referenced by sxnddesambig_it().
SXVOID output_repair_list | ( | void | ) |
Definition at line 429 of file sxndp_rcvr.c.
References output_repair_string().
Referenced by sxnddesambig_it().
SXVOID output_repair_string | ( | SXINT | output_repair_string_index | ) |
Definition at line 406 of file sxndp_rcvr.c.
References sxerror(), and sxplocals.
Referenced by do_put_error(), and output_repair_list().
static SXVOID output_rule | ( | SXINT | rule | ) | [static] |
static SXVOID parse_forest | ( | void | ) | [static] |
Definition at line 1522 of file sxndparser.c.
References build_a_rule(), ME, p, seek_paths(), set_rule(), set_start_symbol(), SXBOOLEAN, sxplocals, sxtrap(), and XxY_set().
Referenced by reducer().
static SXVOID parsers_oflw | ( | SXINT | old_size, | |
SXINT | new_size | |||
) | [static] |
static SXVOID push_new_nt | ( | SXINT | symbol | ) | [static] |
Definition at line 1945 of file sxndparser.c.
References hook_symbol_set, PUSH, symbol_set, and symbol_stack.
Referenced by expand_rule(), and unused_rule_elimination().
SXVOID reducer | ( | void | ) |
Definition at line 1840 of file sxndparser.c.
References clear_triples(), do_limited_reductions(), do_pops(), p, parse_forest(), single_reduce(), sxba_copy(), sxba_empty(), SXFALSE, sxplocals, SXTRUE, and XxYxZ_clear().
Referenced by compute_a_trans(), compute_vt_set(), global_recovery(), is_a_right_ctxt(), sxnd2parse_it(), sxndparse_a_token(), sxndparse_in_la(), and sxndparse_it().
static SXVOID seek_paths | ( | SXINT | p, | |
SXINT | p_trans, | |||
SXBOOLEAN | is_in_set, | |||
SXINT | l | |||
) | [static] |
Definition at line 1383 of file sxndparser.c.
References build_a_rule(), set_rule(), son, sxba_scan_reset(), SXBOOLEAN, SXFALSE, SXTRUE, and XxY_set().
Referenced by parse_forest().
SXVOID set_first_trans | ( | struct SXP_bases * | abase, | |
SXINT * | check, | |||
SXINT * | action, | |||
SXINT | Max, | |||
SXINT * | next_action_kind | |||
) |
Definition at line 319 of file sxndparser.c.
References Commun, Defaut, Done, set_next_item(), and sxplocals.
Referenced by ARC_deriv(), check_ctxt(), create_path(), deriv(), recovery(), reduce_already_seen(), set_vt_set(), and sxndsubparse_a_token().
static SXBOOLEAN set_next_item | ( | struct SXP_item * | vector, | |
SXINT * | check, | |||
SXINT * | action, | |||
SXINT | Max | |||
) | [static] |
Definition at line 297 of file sxndparser.c.
References SXFALSE, sxplocals, SXTRUE, and val.
Referenced by set_first_trans(), and set_next_trans().
SXBOOLEAN set_next_trans | ( | struct SXP_bases * | abase, | |
SXINT * | check, | |||
SXINT * | action, | |||
SXINT | Max, | |||
SXINT * | next_action_kind | |||
) |
Definition at line 343 of file sxndparser.c.
References Commun, Defaut, Done, Propre, set_next_item(), SXFALSE, sxplocals, sxtrap(), and SXTRUE.
Referenced by ARC_deriv(), check_ctxt(), create_path(), deriv(), recovery(), reduce_already_seen(), set_vt_set(), and sxndsubparse_a_token().
void set_rule | ( | SXINT | lhs, | |
SXINT | rhs | |||
) |
Definition at line 445 of file sxndparser.c.
References ME, reduce(), sxplocals, sxtrap(), SXTRUE, and XxY_set().
Referenced by build_a_rule(), parse_forest(), and seek_paths().
SXVOID set_start_symbol | ( | SXINT | symbol | ) |
Definition at line 500 of file sxndparser.c.
References new_symbol(), and XxY_set().
Referenced by parse_forest(), and sxndsubparse_a_token().
static void single_reduce | ( | SXINT | xtriple, | |
SXBOOLEAN | is_limited | |||
) | [static] |
Definition at line 1790 of file sxndparser.c.
References do_limited_pops(), do_pops(), SXBOOLEAN, sxplocals, and SXTRUE.
Referenced by reducer().
static SXVOID sons_oflw | ( | SXINT | old_size, | |
SXINT | new_size | |||
) | [static] |
static SXBOOLEAN sxnd2_error_detected | ( | void | ) | [static] |
Definition at line 2950 of file sxndparser.c.
References SXFALSE, and SXTRUE.
Referenced by sxnd2parse_it().
static SXVOID sxnd2parse_it | ( | void | ) | [static] |
Definition at line 2984 of file sxndparser.c.
References dag_set(), ME, reducer(), SXBOOLEAN, SXFALSE, sxnd2_error_detected(), sxndsubparse_a_token(), sxplocals, sxtrap(), and SXTRUE.
Referenced by sxnd2parser().
SXBOOLEAN sxnd2parser | ( | SXINT | what_to_do, | |
struct sxtables * | arg | |||
) |
Definition at line 3790 of file sxndparser.c.
References sxexit(), sxnd2parse_it(), sxnddesambig_it(), sxndparser(), sxndtkn_mngr(), sxplocals, sxstderr, and SXTRUE.
static SXBOOLEAN sxnddesambig_it | ( | void | ) | [static] |
Definition at line 3107 of file sxndparser.c.
References do_put_error(), output_grammar(), output_repair_list(), SXBOOLEAN, sxivoid(), sxndrtw_walk(), sxndtw_check_grammar(), sxndtw_close(), sxndtw_final(), sxndtw_init(), sxndtw_sem_calls(), sxplocals, sxtime(), sxtty, sxvoid(), and unused_rule_elimination().
Referenced by sxnd2parser(), and sxndparser().
SXBOOLEAN sxndparse_clean_forest | ( | void | ) |
Definition at line 3286 of file sxndparser.c.
References ME, sxba_0_lrscan(), sxba_scan(), SXFALSE, sxndparse_erase_hook_item(), sxplocals, sxtrap(), and SXTRUE.
void sxndparse_erase_hook_item | ( | SXINT | item | ) |
Definition at line 3255 of file sxndparser.c.
Referenced by sxndparse_clean_forest().
SXBOOLEAN sxndparse_in_la | ( | SXINT | ep_la, | |
SXINT | Ttok_no, | |||
SXINT * | Htok_no, | |||
struct sxparse_mode * | mode_ptr | |||
) |
Definition at line 3845 of file sxndparser.c.
References create_ref(), NDP_access(), new_parser(), reducer(), SXBOOLEAN, sxget_token(), sxndsubparse_a_token(), and sxplocals.
static SXVOID sxndparse_it | ( | void | ) | [static] |
Definition at line 2672 of file sxndparser.c.
References ME, reducer(), SXFALSE, sxndsubparse_a_token(), sxplocals, sxtime(), sxtrap(), and SXTRUE.
Referenced by sxndparser().
void sxndparse_pack_forest | ( | void | ) |
Definition at line 3434 of file sxndparser.c.
References ME, sxba_0_lrscan(), sxba_scan(), and sxtrap().
SXBOOLEAN sxndparser | ( | SXINT | what_to_do, | |
struct sxtables * | arg | |||
) |
Definition at line 3533 of file sxndparser.c.
References create_ref(), ME, NDP_access(), new_parser(), parsers_oflw(), sons_oflw(), stdout_or_NULL, sxba_calloc(), sxbm_calloc(), sxcheck_magic_number(), sxexit(), SXFALSE, sxnddesambig_it(), sxndparse_it(), sxplocals, sxstderr, sxtkn_mngr(), SXTRUE, symbols_oflw(), XxY_alloc(), XxY_free(), XxYxZ_alloc(), and XxYxZ_free().
SXVOID sxndparser_GC | ( | SXINT | current_parser | ) |
Definition at line 70 of file sxndparser.c.
References son, sxba_1_rlscan(), sxba_fill(), SXBOOLEAN, SXFALSE, and SXTRUE.
Referenced by ndp_recovery(), and new_parser().
SXBOOLEAN sxndsubparse_a_token | ( | SXINT | parser, | |
SXINT | ref, | |||
SXINT | symbol, | |||
SXINT(*)(SXINT, SXINT, SXINT) | f | |||
) |
Definition at line 912 of file sxndparser.c.
References create_ref(), mreds_push(), NDP_access(), new_parser(), set_first_trans(), set_next_trans(), set_start_symbol(), set_unit_rule(), SXBOOLEAN, SXFALSE, sxplocals, and SXTRUE.
static SXVOID symbols_oflw | ( | SXINT | old_size, | |
SXINT | new_size | |||
) | [static] |
Definition at line 232 of file sxndparser.c.
Referenced by sxndparser().
static SXVOID unused_rule_elimination | ( | void | ) | [static] |
Definition at line 2158 of file sxndparser.c.
References expand_rule(), grammar_new_rule(), grammar_put(), hook_construction(), hook_symbol_set, POP, PUSH, push_new_nt(), rhs_stack, SS_alloc(), sxba_calloc(), sxba_scan(), sxba_scan_reset(), SXFALSE, sxplocals, symb_to_rule_hd, symb_to_rule_list, symbol_set, and symbol_stack.
Referenced by sxnddesambig_it().
SXBA hook_symbol_set [static] |
Definition at line 63 of file sxndparser.c.
Referenced by push_new_nt(), and unused_rule_elimination().
Definition at line 27 of file sxndparser.c.
Referenced by build_a_rule(), create_ref(), dag_set(), do_reductions(), hook_construction(), mreds_push(), new_parser(), new_symbol(), parse_forest(), set_rule(), sxnd2parse_it(), sxndparse_clean_forest(), sxndparse_it(), sxndparse_pack_forest(), and sxndparser().
SXINT* rhs_stack [static] |
Definition at line 62 of file sxndparser.c.
Referenced by expand_rule(), and unused_rule_elimination().
SXINT * symb_to_rule_hd [static] |
Definition at line 62 of file sxndparser.c.
Referenced by grammar_new_rule(), hook_construction(), and unused_rule_elimination().
SXINT * symb_to_rule_list [static] |
Definition at line 62 of file sxndparser.c.
Referenced by grammar_new_rule(), hook_construction(), and unused_rule_elimination().
SXINT * symbol_stack [static] |
Definition at line 62 of file sxndparser.c.
Referenced by push_new_nt(), and unused_rule_elimination().
char WHAT_SXNDPARSER32[] = "@(#)SYNTAX - $Id: sxndparser.c 1491 2008-07-23 16:13:15Z sagot $ SXNDPARSER_32" WHAT_DEBUG |
Definition at line 41 of file sxndparser.c.