From: Per Bothner Date: Wed, 14 Jun 1995 21:30:58 +0000 (+0000) Subject: * ch-exp.y: Remove lots of unsupported productions and names. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0faa324790e39f1f99e816320973a5012941da47;p=binutils-gdb.git * ch-exp.y: Remove lots of unsupported productions and names. Add support for IF-expressions, ORIF, ANDID, NUM, and ADDR. This makes progress for PR 5826. --- diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y index c450b5c2238..e7b4558967f 100644 --- a/gdb/ch-exp.y +++ b/gdb/ch-exp.y @@ -153,43 +153,12 @@ yyerror PARAMS ((char *)); int *ivec; } -%token FIXME_01 -%token FIXME_02 -%token FIXME_03 -%token FIXME_04 -%token FIXME_05 -%token FIXME_06 -%token FIXME_07 -%token FIXME_08 -%token FIXME_09 -%token FIXME_10 -%token FIXME_11 -%token FIXME_12 -%token FIXME_13 -%token FIXME_14 -%token FIXME_15 -%token FIXME_16 -%token FIXME_17 -%token FIXME_18 -%token FIXME_19 -%token FIXME_20 -%token FIXME_21 -%token FIXME_22 -%token FIXME_24 -%token FIXME_25 -%token FIXME_26 -%token FIXME_27 -%token FIXME_28 -%token FIXME_29 -%token FIXME_30 - %token INTEGER_LITERAL %token BOOLEAN_LITERAL %token CHARACTER_LITERAL %token FLOAT_LITERAL %token GENERAL_PROCEDURE_NAME %token LOCATION_NAME -%token SET_LITERAL %token EMPTINESS_LITERAL %token CHARACTER_STRING_LITERAL %token BIT_STRING_LITERAL @@ -242,6 +211,7 @@ yyerror PARAMS ((char *)); %token CARD %token MAX_TOKEN %token MIN_TOKEN +%token ADDR_TOKEN %token SIZE %token UPPER %token LOWER @@ -264,20 +234,13 @@ yyerror PARAMS ((char *)); %type tuple %type slice %type expression_conversion -%type value_procedure_call %type value_built_in_routine_call -%type chill_value_built_in_routine_call -%type start_expression -%type zero_adic_operator %type parenthesised_expression %type value -%type undefined_value %type expression %type conditional_expression %type then_alternative %type else_alternative -%type sub_expression -%type value_case_alternative %type operand_0 %type operand_1 %type operand_2 @@ -285,24 +248,19 @@ yyerror PARAMS ((char *)); %type operand_4 %type operand_5 %type operand_6 -%type synonym_name -%type value_enumeration_name -%type value_do_with_name -%type value_receive_name %type expression_list %type mode_argument -%type array_mode_name -%type string_mode_name -%type variant_structure_mode_name -%type boolean_expression -%type case_selector_list -%type subexpression -%type case_label_specification -%type buffer_location %type single_assignment_action %type mode_name %type rparen +/* Not implemented: +%type undefined_value +%type array_mode_name +%type string_mode_name +%type variant_structure_mode_name +*/ + %% /* Z.200, 5.3.1 */ @@ -315,19 +273,10 @@ start : value { } ; value : expression - { - $$ = 0; /* FIXME */ - } +/* | undefined_value - { - $$ = 0; /* FIXME */ - } - ; - -undefined_value : FIXME_01 - { - $$ = 0; /* FIXME */ - } + { ??? } +*/ ; /* Z.200, 4.2.2 */ @@ -357,10 +306,6 @@ access_name : LOCATION_NAME write_exp_elt_intern ($1); write_exp_elt_opcode (OP_INTERNALVAR); } - | FIXME_03 - { - $$ = 0; /* FIXME */ - } ; /* Z.200, 4.2.8 */ @@ -420,66 +365,23 @@ primitive_value : write_exp_elt_opcode (UNOP_IND); } | value_name - { - $$ = 0; /* FIXME */ - } | literal - { - $$ = 0; /* FIXME */ - } | tuple - { - $$ = 0; /* FIXME */ - } | slice - { - $$ = 0; /* FIXME */ - } | expression_conversion - { - $$ = 0; /* FIXME */ - } - | value_procedure_call - { - $$ = 0; /* FIXME */ - } | value_built_in_routine_call - { - $$ = 0; /* FIXME */ - } +/* | start_expression - { - $$ = 0; /* FIXME */ - } + { ??? } | zero_adic_operator - { - $$ = 0; /* FIXME */ - } + { ??? } +*/ | parenthesised_expression - { - $$ = 0; /* FIXME */ - } ; /* Z.200, 5.2.3 */ -value_name : synonym_name - { - $$ = 0; /* FIXME */ - } - | value_enumeration_name - { - $$ = 0; /* FIXME */ - } - | value_do_with_name - { - $$ = 0; /* FIXME */ - } - | value_receive_name - { - $$ = 0; /* FIXME */ - } - | GENERAL_PROCEDURE_NAME +value_name : GENERAL_PROCEDURE_NAME { write_exp_elt_opcode (OP_VAR_VALUE); write_exp_elt_block (NULL); @@ -517,10 +419,6 @@ literal : INTEGER_LITERAL write_exp_elt_dblcst ($1); write_exp_elt_opcode (OP_DOUBLE); } - | SET_LITERAL - { - $$ = 0; /* FIXME */ - } | EMPTINESS_LITERAL { struct type *void_ptr_type @@ -641,113 +539,44 @@ expression_conversion: mode_name parenthesised_expression } ; -/* Z.200, 5.2.12 */ - -value_procedure_call: FIXME_05 - { - $$ = 0; /* FIXME */ - } - ; - -/* Z.200, 5.2.13 */ - -value_built_in_routine_call: chill_value_built_in_routine_call - { - $$ = 0; /* FIXME */ - } - ; - -/* Z.200, 5.2.14 */ - -start_expression: FIXME_06 - { - $$ = 0; /* FIXME */ - } /* Not in GNU-Chill */ - ; - -/* Z.200, 5.2.15 */ - -zero_adic_operator: FIXME_07 - { - $$ = 0; /* FIXME */ - } - ; - /* Z.200, 5.2.16 */ parenthesised_expression: '(' expression ')' - { - $$ = 0; /* FIXME */ - } ; /* Z.200, 5.3.2 */ expression : operand_0 - { - $$ = 0; /* FIXME */ - } | single_assignment_action - { - $$ = 0; /* FIXME */ - } | conditional_expression - { - $$ = 0; /* FIXME */ - } ; -conditional_expression : IF boolean_expression then_alternative else_alternative FI - { - $$ = 0; /* FIXME */ - } - | CASE case_selector_list OF value_case_alternative ELSE sub_expression ESAC - { - $$ = 0; /* FIXME */ - } +conditional_expression : IF expression then_alternative else_alternative FI + { write_exp_elt_opcode (TERNOP_COND); } +/* + | CASE case_selector_list OF value_case_alternative ELSE expression ESAC + { error ("not implemented: CASE expression" } +*/ ; -then_alternative: THEN subexpression - { - $$ = 0; /* FIXME */ - } +then_alternative: THEN expression ; -else_alternative: ELSE subexpression - { - $$ = 0; /* FIXME */ - } - | ELSIF boolean_expression then_alternative else_alternative - { - $$ = 0; /* FIXME */ - } - ; - -sub_expression : expression - { - $$ = 0; /* FIXME */ - } - ; - -value_case_alternative: case_label_specification ':' sub_expression ';' - { - $$ = 0; /* FIXME */ - } +else_alternative: ELSE expression + | ELSIF expression then_alternative else_alternative + { write_exp_elt_opcode (TERNOP_COND); } ; /* Z.200, 5.3.3 */ operand_0 : operand_1 - { - $$ = 0; /* FIXME */ - } | operand_0 LOGIOR operand_1 { write_exp_elt_opcode (BINOP_BITWISE_IOR); } | operand_0 ORIF operand_1 { - $$ = 0; /* FIXME */ + write_exp_elt_opcode (BINOP_LOGICAL_OR); } | operand_0 LOGXOR operand_1 { @@ -758,25 +587,19 @@ operand_0 : operand_1 /* Z.200, 5.3.4 */ operand_1 : operand_2 - { - $$ = 0; /* FIXME */ - } | operand_1 LOGAND operand_2 { write_exp_elt_opcode (BINOP_BITWISE_AND); } | operand_1 ANDIF operand_2 { - $$ = 0; /* FIXME */ + write_exp_elt_opcode (BINOP_LOGICAL_AND); } ; /* Z.200, 5.3.5 */ operand_2 : operand_3 - { - $$ = 0; /* FIXME */ - } | operand_2 '=' operand_3 { write_exp_elt_opcode (BINOP_EQUAL); @@ -811,9 +634,6 @@ operand_2 : operand_3 /* Z.200, 5.3.6 */ operand_3 : operand_4 - { - $$ = 0; /* FIXME */ - } | operand_3 '+' operand_4 { write_exp_elt_opcode (BINOP_ADD); @@ -831,9 +651,6 @@ operand_3 : operand_4 /* Z.200, 5.3.7 */ operand_4 : operand_5 - { - $$ = 0; /* FIXME */ - } | operand_4 '*' operand_5 { write_exp_elt_opcode (BINOP_MUL); @@ -855,9 +672,6 @@ operand_4 : operand_5 /* Z.200, 5.3.8 */ operand_5 : operand_6 - { - $$ = 0; /* FIXME */ - } | '-' operand_6 { write_exp_elt_opcode (UNOP_NEG); @@ -880,14 +694,9 @@ operand_6 : POINTER primitive_value { write_exp_elt_opcode (UNOP_ADDR); } - | RECEIVE buffer_location - { - $$ = 0; /* FIXME */ - } + | RECEIVE expression + { error ("not implemented: RECEIVE expression"); } | primitive_value - { - $$ = 0; /* FIXME */ - } ; @@ -902,35 +711,27 @@ single_assignment_action : /* Z.200, 6.20.3 */ -chill_value_built_in_routine_call : +value_built_in_routine_call : NUM '(' expression ')' { - $$ = 0; /* FIXME */ + write_exp_elt_opcode (UNOP_CAST); + write_exp_elt_type (builtin_type_int); + write_exp_elt_opcode (UNOP_CAST); } | PRED '(' expression ')' - { - $$ = 0; /* FIXME */ - } + { error ("not implemented: PRED builtin function"); } | SUCC '(' expression ')' - { - $$ = 0; /* FIXME */ - } + { error ("not implemented: SUCC builtin function"); } + | ADDR_TOKEN '(' expression ')' + { write_exp_elt_opcode (UNOP_ADDR); } | ABS '(' expression ')' - { - $$ = 0; /* FIXME */ - } + { error ("not implemented: ABS builtin function"); } | CARD '(' expression ')' - { - $$ = 0; /* FIXME */ - } + { error ("not implemented: CARD builtin function"); } | MAX_TOKEN '(' expression ')' - { - $$ = 0; /* FIXME */ - } + { error ("not implemented: MAX builtin function"); } | MIN_TOKEN '(' expression ')' - { - $$ = 0; /* FIXME */ - } + { error ("not implemented: MIN builtin function"); } | SIZE '(' expression ')' { write_exp_elt_opcode (UNOP_SIZEOF); } | SIZE '(' mode_argument ')' @@ -954,38 +755,19 @@ mode_argument : mode_name { $$ = $1.type; } +/* | array_mode_name '(' expression ')' - { - $$ = 0; /* FIXME */ - } + { ??? } | string_mode_name '(' expression ')' - { - $$ = 0; /* FIXME */ - } + { ??? } | variant_structure_mode_name '(' expression_list ')' - { - $$ = 0; /* FIXME */ - } + { ??? } +*/ ; mode_name : TYPENAME ; -/* Things which still need productions... */ - -array_mode_name : FIXME_08 { $$ = 0; } -string_mode_name : FIXME_09 { $$ = 0; } -variant_structure_mode_name: FIXME_10 { $$ = 0; } -synonym_name : FIXME_11 { $$ = 0; } -value_enumeration_name : FIXME_12 { $$ = 0; } -value_do_with_name : FIXME_13 { $$ = 0; } -value_receive_name : FIXME_14 { $$ = 0; } -boolean_expression : FIXME_26 { $$ = 0; } -case_selector_list : FIXME_27 { $$ = 0; } -subexpression : FIXME_28 { $$ = 0; } -case_label_specification: FIXME_29 { $$ = 0; } -buffer_location : FIXME_30 { $$ = 0; } - %% /* Implementation of a dynamically expandable buffer for processing input @@ -1752,6 +1534,7 @@ static const struct token idtokentab[] = { "in", IN }, { "or", LOGIOR }, { "up", UP }, + { "addr", ADDR_TOKEN }, { "null", EMPTINESS_LITERAL } };