Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

parser.c File Reference

Go to the source code of this file.

Functions

void reset_placeholder_variable_generator (void)
test make_placeholder_test (char first_letter)
void substitute_for_placeholders_in_symbol (Symbol **sym)
void substitute_for_placeholders_in_test (test *t)
void substitute_for_placeholders_in_condition_list (condition *cond)
void substitute_for_placeholders_in_action_list (action *a)
Symbolmake_symbol_for_current_lexeme (void)
test parse_relational_test (void)
test parse_disjunction_test (void)
test parse_simple_test (void)
test parse_test (void)
void fill_in_id_tests (condition *conds, test t)
void fill_in_attr_tests (condition *conds, test t)
conditionnegate_condition_list (condition *conds)
conditionparse_conds_for_one_id (char first_letter_if_no_id_given, test *dest_id_test)
conditionparse_value_test_star (char first_letter)
conditionparse_attr_value_tests (void)
test parse_head_of_conds_for_one_id (char first_letter_if_no_id_given)
conditionparse_tail_of_conds_for_one_id (void)
conditionparse_cond_plus (void)
conditionparse_cond (void)
conditionparse_lhs (void)
rhs_value parse_rhs_value (void)
rhs_value parse_function_call_after_lparen (bool is_stand_alone_action)
bool is_preference_lexeme (enum lexer_token_type test_lexeme)
byte parse_preference_specifier_without_referent (void)
actionparse_preferences (Symbol *id, rhs_value attr, rhs_value value)
actionparse_preferences_soar8_non_operator (Symbol *id, rhs_value attr, rhs_value value)
actionparse_attr_value_make (Symbol *id)
actionparse_rhs_action (void)
bool parse_rhs (action **dest_rhs)
actiondestructively_reverse_action_list (action *a)
productionparse_production (void)

Variables

unsigned long placeholder_counter [26]
char * help_on_lhs_grammar []
char * help_on_rhs_grammar []


Function Documentation

action* destructively_reverse_action_list action a  ) 
 

Definition at line 1813 of file parser.c.

References action, and action_struct::next.

Referenced by parse_production().

void fill_in_attr_tests condition conds,
test  t
 

Definition at line 550 of file parser.c.

References three_field_tests_struct::attr_test, condition, copy_of_equality_test_found_in_test(), copy_test(), condition_struct::data, deallocate_test(), condition_struct::condition_main_data_union::ncc, condition_struct::next, test, condition_struct::condition_main_data_union::tests, ncc_info_struct::top, and condition_struct::type.

Referenced by parse_attr_value_tests().

void fill_in_id_tests condition conds,
test  t
 

Definition at line 513 of file parser.c.

References condition, copy_of_equality_test_found_in_test(), copy_test(), condition_struct::data, deallocate_test(), three_field_tests_struct::id_test, condition_struct::condition_main_data_union::ncc, condition_struct::next, test, condition_struct::condition_main_data_union::tests, ncc_info_struct::top, and condition_struct::type.

Referenced by parse_attr_value_tests(), and parse_conds_for_one_id().

bool is_preference_lexeme enum lexer_token_type  test_lexeme  ) 
 

Definition at line 1276 of file parser.c.

References AMPERSAND_LEXEME, AT_LEXEME, EQUAL_LEXEME, EXCLAMATION_POINT_LEXEME, GREATER_LEXEME, LESS_LEXEME, MINUS_LEXEME, PLUS_LEXEME, and TILDE_LEXEME.

Referenced by parse_preference_specifier_without_referent().

test make_placeholder_test char  first_letter  ) 
 

Definition at line 81 of file parser.c.

References variable_struct::current_binding_value, make_variable(), placeholder_counter, Symbol, test, tolower(), and symbol_union::var.

Referenced by parse_attr_value_tests(), parse_head_of_conds_for_one_id(), parse_tail_of_conds_for_one_id(), and parse_value_test_star().

Symbol* make_symbol_for_current_lexeme void   ) 
 

Definition at line 269 of file parser.c.

References abort_with_fatal_error(), FLOAT_CONSTANT_LEXEME, IDENTIFIER_LEXEME, INT_CONSTANT_LEXEME, make_float_constant(), make_int_constant(), make_sym_constant(), make_variable(), SYM_CONSTANT_LEXEME, Symbol, and VARIABLE_LEXEME.

Referenced by parse_disjunction_test(), parse_relational_test(), parse_rhs_value(), and read_wme_filter_component().

condition* negate_condition_list condition conds  ) 
 

Definition at line 597 of file parser.c.

References ncc_info_struct::bottom, condition, condition_struct::data, condition_struct::condition_main_data_union::ncc, condition_struct::next, condition_struct::prev, ncc_info_struct::top, and condition_struct::type.

Referenced by parse_attr_value_tests(), and parse_cond().

action* parse_attr_value_make Symbol id  ) 
 

Definition at line 1624 of file parser.c.

References action, variable_struct::current_binding_value, deallocate_action_list(), deallocate_rhs_value(), first_letter_from_rhs_value(), get_lexeme(), make_variable(), action_struct::next, parse_preferences(), parse_preferences_soar8_non_operator(), parse_rhs_value(), PERIOD_LEXEME, placeholder_counter, print(), print_location_of_most_recent_lexeme(), R_PAREN_LEXEME, rhs_value, rhs_value_to_string(), Symbol, UP_ARROW_LEXEME, and symbol_union::var.

Referenced by parse_rhs_action().

condition* parse_attr_value_tests void   ) 
 

Definition at line 715 of file parser.c.

References add_new_test_to_test(), condition, copy_test(), condition_struct::data, deallocate_condition_list(), deallocate_test(), fill_in_attr_tests(), fill_in_id_tests(), first_letter_from_test(), get_lexeme(), three_field_tests_struct::id_test, make_placeholder_test(), MINUS_LEXEME, negate_condition_list(), condition_struct::next, parse_test(), parse_value_test_star(), PERIOD_LEXEME, condition_struct::prev, print(), print_location_of_most_recent_lexeme(), test, test_includes_equality_test_for_symbol(), condition_struct::condition_main_data_union::tests, condition_struct::type, and UP_ARROW_LEXEME.

Referenced by parse_tail_of_conds_for_one_id().

condition* parse_cond void   ) 
 

Definition at line 997 of file parser.c.

References condition, deallocate_condition_list(), get_lexeme(), L_BRACE_LEXEME, MINUS_LEXEME, negate_condition_list(), parse_cond_plus(), parse_conds_for_one_id(), print(), print_location_of_most_recent_lexeme(), and R_BRACE_LEXEME.

Referenced by parse_cond_plus().

condition * parse_cond_plus void   ) 
 

Definition at line 1043 of file parser.c.

References condition, deallocate_condition_list(), L_BRACE_LEXEME, L_PAREN_LEXEME, MINUS_LEXEME, condition_struct::next, parse_cond(), and condition_struct::prev.

Referenced by parse_cond(), and parse_lhs().

condition * parse_conds_for_one_id char  first_letter_if_no_id_given,
test dest_id_test
 

Definition at line 957 of file parser.c.

References condition, copy_of_equality_test_found_in_test(), deallocate_test(), fill_in_id_tests(), parse_head_of_conds_for_one_id(), parse_tail_of_conds_for_one_id(), and test.

Referenced by parse_cond(), and parse_value_test_star().

test parse_disjunction_test void   ) 
 

Definition at line 405 of file parser.c.

References complex_test, complex_test_struct::data, deallocate_test(), destructively_reverse_list(), complex_test_struct::test_info_union::disjunction_list, FLOAT_CONSTANT_LEXEME, get_lexeme(), GREATER_GREATER_LEXEME, INT_CONSTANT_LEXEME, LESS_LESS_LEXEME, make_symbol_for_current_lexeme(), print(), print_location_of_most_recent_lexeme(), SYM_CONSTANT_LEXEME, test, and complex_test_struct::type.

Referenced by parse_simple_test().

rhs_value parse_function_call_after_lparen bool  is_stand_alone_action  ) 
 

Definition at line 1165 of file parser.c.

References rhs_function_struct::can_be_rhs_value, rhs_function_struct::can_be_stand_alone_action, cons, deallocate_rhs_value(), find_sym_constant(), cons_struct::first, get_lexeme(), list, lookup_rhs_function(), MINUS_LEXEME, sym_constant_struct::name, rhs_function_struct::name, rhs_function_struct::num_args_expected, parse_rhs_value(), PLUS_LEXEME, print(), print_location_of_most_recent_lexeme(), R_PAREN_LEXEME, cons_struct::rest, rhs_function, rhs_value, symbol_union::sc, and Symbol.

Referenced by parse_rhs_action(), and parse_rhs_value().

test parse_head_of_conds_for_one_id char  first_letter_if_no_id_given  ) 
 

Definition at line 819 of file parser.c.

References add_new_test_to_test(), complex_test, copy_of_equality_test_found_in_test(), deallocate_test(), get_lexeme(), L_PAREN_LEXEME, make_placeholder_test(), MINUS_LEXEME, parse_test(), print(), print_location_of_most_recent_lexeme(), print_with_symbols(), R_PAREN_LEXEME, SYM_CONSTANT_LEXEME, Symbol, test, test_includes_equality_test_for_symbol(), complex_test_struct::type, and UP_ARROW_LEXEME.

Referenced by parse_conds_for_one_id().

condition* parse_lhs void   ) 
 

Definition at line 1075 of file parser.c.

References condition, and parse_cond_plus().

Referenced by parse_production(), and read_pattern_and_get_matching_productions().

byte parse_preference_specifier_without_referent void   ) 
 

Definition at line 1326 of file parser.c.

References AMPERSAND_LEXEME, AT_LEXEME, byte, COMMA_LEXEME, EQUAL_LEXEME, EXCLAMATION_POINT_LEXEME, get_lexeme(), GREATER_LEXEME, is_preference_lexeme(), LESS_LEXEME, MINUS_LEXEME, PLUS_LEXEME, R_PAREN_LEXEME, TILDE_LEXEME, and UP_ARROW_LEXEME.

Referenced by parse_preferences(), and parse_preferences_soar8_non_operator().

action* parse_preferences Symbol id,
rhs_value  attr,
rhs_value  value
 

Definition at line 1433 of file parser.c.

References action, byte, COMMA_LEXEME, copy_rhs_value(), deallocate_action_list(), get_lexeme(), action_struct::next, parse_preference_specifier_without_referent(), parse_rhs_value(), PLUS_LEXEME, rhs_value, Symbol, and action_struct::type.

Referenced by parse_attr_value_make().

action* parse_preferences_soar8_non_operator Symbol id,
rhs_value  attr,
rhs_value  value
 

Definition at line 1520 of file parser.c.

References action, byte, COMMA_LEXEME, copy_rhs_value(), deallocate_action_list(), get_lexeme(), action_struct::next, parse_preference_specifier_without_referent(), PLUS_LEXEME, print(), print_location_of_most_recent_lexeme(), print_with_symbols(), rhs_value, Symbol, and action_struct::type.

Referenced by parse_attr_value_make().

production* parse_production void   ) 
 

Definition at line 1839 of file parser.c.

References action, add_production_to_rete(), byte, condition, deallocate_action_list(), deallocate_condition_list(), production_struct::declared_support, destructively_reverse_action_list(), production_struct::documentation, excise_production(), free_memory_block_for_string(), get_lexeme(), production_struct::interrupt, make_memory_block_for_string(), make_production(), make_sym_constant(), condition_struct::next, parse_lhs(), parse_rhs(), print(), print_location_of_most_recent_lexeme(), print_with_symbols(), production, sym_constant_struct::production, QUOTED_STRING_LEXEME, R_PAREN_LEXEME, reset_placeholder_variable_generator(), reset_variable_generator(), RIGHT_ARROW_LEXEME, symbol_union::sc, substitute_for_placeholders_in_action_list(), substitute_for_placeholders_in_condition_list(), SYM_CONSTANT_LEXEME, and Symbol.

Referenced by soar_ecSp().

test parse_relational_test void   ) 
 

Definition at line 320 of file parser.c.

References byte, complex_test, complex_test_struct::data, EQUAL_LEXEME, FLOAT_CONSTANT_LEXEME, get_lexeme(), GREATER_EQUAL_LEXEME, GREATER_LEXEME, INT_CONSTANT_LEXEME, LESS_EQUAL_GREATER_LEXEME, LESS_EQUAL_LEXEME, LESS_LEXEME, make_symbol_for_current_lexeme(), NOT_EQUAL_LEXEME, print(), print_location_of_most_recent_lexeme(), complex_test_struct::test_info_union::referent, SYM_CONSTANT_LEXEME, Symbol, test, complex_test_struct::type, and VARIABLE_LEXEME.

Referenced by parse_simple_test().

bool parse_rhs action **  dest_rhs  ) 
 

Definition at line 1780 of file parser.c.

References action, deallocate_action_list(), action_struct::next, parse_rhs_action(), and R_PAREN_LEXEME.

Referenced by parse_production(), and read_rhs_pattern_and_get_matching_productions().

action* parse_rhs_action void   ) 
 

Definition at line 1727 of file parser.c.

References action, deallocate_action_list(), get_lexeme(), L_PAREN_LEXEME, make_variable(), action_struct::next, parse_attr_value_make(), parse_function_call_after_lparen(), print(), print_location_of_most_recent_lexeme(), R_PAREN_LEXEME, rhs_value, Symbol, action_struct::type, action_struct::value, and VARIABLE_LEXEME.

Referenced by parse_rhs().

rhs_value parse_rhs_value void   ) 
 

Definition at line 1248 of file parser.c.

References FLOAT_CONSTANT_LEXEME, get_lexeme(), INT_CONSTANT_LEXEME, L_PAREN_LEXEME, make_symbol_for_current_lexeme(), parse_function_call_after_lparen(), print(), print_location_of_most_recent_lexeme(), rhs_value, SYM_CONSTANT_LEXEME, and VARIABLE_LEXEME.

Referenced by parse_attr_value_make(), parse_function_call_after_lparen(), and parse_preferences().

test parse_simple_test void   ) 
 

Definition at line 448 of file parser.c.

References LESS_LESS_LEXEME, parse_disjunction_test(), parse_relational_test(), and test.

Referenced by parse_test().

condition* parse_tail_of_conds_for_one_id void   ) 
 

Definition at line 897 of file parser.c.

References three_field_tests_struct::attr_test, condition, condition_struct::data, deallocate_condition_list(), get_lexeme(), three_field_tests_struct::id_test, make_placeholder_test(), condition_struct::next, parse_attr_value_tests(), condition_struct::prev, R_PAREN_LEXEME, condition_struct::test_for_acceptable_preference, condition_struct::condition_main_data_union::tests, condition_struct::type, and three_field_tests_struct::value_test.

Referenced by parse_conds_for_one_id().

test parse_test void   ) 
 

Definition at line 462 of file parser.c.

References add_new_test_to_test(), complex_test, complex_test_struct::test_info_union::conjunct_list, complex_test_struct::data, deallocate_test(), destructively_reverse_list(), get_lexeme(), L_BRACE_LEXEME, parse_simple_test(), R_BRACE_LEXEME, test, and complex_test_struct::type.

Referenced by parse_attr_value_tests(), parse_head_of_conds_for_one_id(), and parse_value_test_star().

condition* parse_value_test_star char  first_letter  ) 
 

Definition at line 638 of file parser.c.

References add_new_test_to_test(), three_field_tests_struct::attr_test, condition, condition_struct::data, deallocate_condition_list(), get_lexeme(), three_field_tests_struct::id_test, L_PAREN_LEXEME, make_placeholder_test(), MINUS_LEXEME, condition_struct::next, parse_conds_for_one_id(), parse_test(), PLUS_LEXEME, condition_struct::prev, R_PAREN_LEXEME, test, condition_struct::test_for_acceptable_preference, test_includes_equality_test_for_symbol(), condition_struct::condition_main_data_union::tests, condition_struct::type, UP_ARROW_LEXEME, and three_field_tests_struct::value_test.

Referenced by parse_attr_value_tests().

void reset_placeholder_variable_generator void   ) 
 

Definition at line 66 of file parser.c.

References placeholder_counter.

Referenced by parse_production().

void substitute_for_placeholders_in_action_list action a  ) 
 

Definition at line 197 of file parser.c.

References action, action_struct::attr, action_struct::id, action_struct::next, substitute_for_placeholders_in_symbol(), Symbol, action_struct::type, and action_struct::value.

Referenced by parse_production().

void substitute_for_placeholders_in_condition_list condition cond  ) 
 

Definition at line 179 of file parser.c.

References three_field_tests_struct::attr_test, condition, condition_struct::data, three_field_tests_struct::id_test, condition_struct::condition_main_data_union::ncc, condition_struct::next, substitute_for_placeholders_in_test(), condition_struct::condition_main_data_union::tests, ncc_info_struct::top, condition_struct::type, and three_field_tests_struct::value_test.

Referenced by parse_production().

void substitute_for_placeholders_in_symbol Symbol **  sym  ) 
 

Definition at line 119 of file parser.c.

References variable_struct::current_binding_value, generate_new_variable(), Symbol, and symbol_union::var.

Referenced by substitute_for_placeholders_in_action_list(), and substitute_for_placeholders_in_test().

void substitute_for_placeholders_in_test test t  ) 
 

Definition at line 149 of file parser.c.

References complex_test, complex_test_struct::test_info_union::conjunct_list, cons, complex_test_struct::data, cons_struct::first, complex_test_struct::test_info_union::referent, cons_struct::rest, substitute_for_placeholders_in_symbol(), Symbol, test, and complex_test_struct::type.

Referenced by substitute_for_placeholders_in_condition_list().


Variable Documentation

char* help_on_lhs_grammar[]
 

Initial value:

 {
    "Grammar for left hand sides of productions:",
    "",
    "   <lhs> ::= <cond>+",
    "   <cond> ::= <positive_cond> | - <positive_cond>",
    "   <positive_cond> ::= <conds_for_one_id> | { <cond>+ }",
    "   <conds_for_one_id> ::= ( [state|impasse] [<id_test>] <attr_value_tests>* )",
    "   <id_test> ::= <test>",
    "   <attr_value_tests> ::= [-] ^ <attr_test> [.<attr_test>]* <value_test>*",
    "   <attr_test> ::= <test>",
    "   <value_test> ::= <test> [+] | <conds_for_one_id> [+]",
    "",
    "   <test> ::= <conjunctive_test> | <simple_test>",
    "   <conjunctive_test> ::= { <simple_test>+ }",
    "   <simple_test> ::= <disjunction_test> | <relational_test>",
    "   <disjunction_test> ::= << <constant>* >>",
    "   <relational_test> ::= [<relation>] <single_test>",
    "   <relation> ::= <> | < | > | <= | >= | = | <=>",
    "   <single_test> ::= variable | <constant>",
    "   <constant> ::= sym_constant | int_constant | float_constant",
    "",
    "See also:  rhs-grammar, sp",
    0
}

Definition at line 238 of file parser.c.

char* help_on_rhs_grammar[]
 

Initial value:

 {
    "Grammar for right hand sides of productions:",
    "",
    "   <rhs> ::= <rhs_action>*",
    "   <rhs_action> ::= ( variable <attr_value_make>+ ) | <function_call>",
    "   <function_call> ::= ( <function_name> <rhs_value>* )",
    "   <function_name> ::= sym_constant | + | -",
    "   <rhs_value> ::= <constant> | <function_call> | variable",
    "   <constant> ::= sym_constant | int_constant | float_constant",
    "   <attr_value_make> ::= ^ <rhs_value> <value_make>+",
    "   <value_make> ::= <rhs_value> <preferences>",
    "",
    "   <preferences> ::= [,] | <preference_specifier>+",
    "   <preference-specifier> ::= <naturally-unary-preference> [,]",
    "                            | <forced-unary-preference>",
    "                            | <binary-preference> <rhs_value> [,]",
    "   <naturally-unary-preference> ::= + | - | ! | ~ | @",
    "   <binary-preference> ::= > | = | < | &",
    "   <any-preference> ::= <naturally-unary-preference> | <binary-preference>",
    "   <forced-unary-preference> ::= <binary-preference> ",
    "                                 {<any-preference> | , | ) | ^}",
    "     ;but the parser shouldn't consume the <any-preference>, \")\" or \"^\"",
    "      lexeme here",
    "",
    "See also:  lhs-grammar, sp",
    0
}

Definition at line 1123 of file parser.c.

unsigned long placeholder_counter[26]
 

Definition at line 64 of file parser.c.

Referenced by make_placeholder_test(), parse_attr_value_make(), and reset_placeholder_variable_generator().


Generated on Thu Dec 11 13:00:27 2003 for Soar Kernel by doxygen 1.3.5