summaryrefslogtreecommitdiff
path: root/gdb/m2-exp.y
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-11-15 17:28:02 +0000
committerFred Fish <fnf@specifix.com>1992-11-15 17:28:02 +0000
commite58de8a23021ce9bbdee715ac79745ebb93437a8 (patch)
tree008503bb278b756abfe43212bf412ab003eb6e7c /gdb/m2-exp.y
parentc1878f87886dd7ae9af9d2aafe8dcf075ecfaa9c (diff)
downloadbinutils-gdb-e58de8a23021ce9bbdee715ac79745ebb93437a8.tar.gz
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c. * Makefile.in (YYOBJ): Add ch-exp.tab.o. * Makefile.in (saber_gdb): Add unload of ch-exp.y and load of ch-exp.tab.c. * Makefile.in (distclean): Add target ch-exp.tab.c. * Makefile.in (realclean): Add rm of ch-exp.tab.c. * Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on Makefile since it contains sed patterns used in generation. Add sed pattern to also delete #include of any malloc.h. * Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets. * ch-exp.y: New expression parser, for GNU-Chill. * c-exp.y, expr.c, expression.h, language.c, m2-exp.y, parser-defs.h, valarith.c, valops.c, value.h: Remap macros and function names to conform to K&R terminology with respect to logical and bitwise operators: UNOP_ZEROP => UNOP_LOGICAL_NOT UNOP_LOGNOT => UNOP_COMPLEMENT BINOP_LOGAND => BINOP_BITWISE_AND BINOP_LOGXOR => BINOP_BITWISE_XOR BINOP_LOGIOR => BINOP_BITWISE_IOR BINOP_AND => BINOP_LOGICAL_AND BINOP_OR => BINOP_LOGICAL_OR PREC_OR => PREC_LOGICAL_OR PREC_AND => PREC_LOGICAL_AND PREC_LOGIOR => PREC_BITWISE_IOR PREC_LOGXOR => PREC_BITWISE_XOR PREC_LOGAND => PREC_BITWISE_AND value_zerop() => value_logical_not() value_lognot() => value_complement() * c-exp.y (c_op_print_tab): Add explicit empty terminator. * m2-exp.y (m2_op_print_tab): Add explicit empty terminator. * defs.h (enum language): Add language_chill. * dwarfread.c (set_cu_language): Add LANG_CHILL case and make LANG_MODULA2 a recognized language. * eval.c (evaluate_subexp): Add OP_BOOL case. * expprint.c (print_subexp): Add OP_BOOL case. * gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for Chill as well as Modula-2. * gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long, builtin_type_chill_ulong, builtin_type_chill_real): Add. * i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary and is nonexistant in some SVR4 based systems. * language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4. * language.c (set_language_command): Add chill. * language.c (binop_result_type, integral_type, character_type, boolean_type, structured_type, value_true, binop_type_check): Add language_chill cases. * language.h (_LANG_chill): Define. * m2-exp.y (number_sign, modblock): Make static, #ifdef out unused modblock. * m2-exp.y (ANDAND): Rename to LOGICAL_AND. * source.c (source_info): Fix minor nits, print "1 line" rather than "1 lines", and "language is <lang>". * symfile.c (deduce_language_from_filename): Recognize the filename extensions ".chill", ".c186", and ".c286" for Chill. * valarith.c (value_binop): Handle TYPE_CODE_BOOL as well as TYPE_CODE_INT and TYPE_CODE_FLOAT. * valprint.c (val_print): Print TYPE_CODE_BOOL type values as "TRUE" or "FALSE". * valprint.c (typedef_print): Add case for language_chill. * values.c (value_from_longest): Handle TYPE_CODE_BOOL.
Diffstat (limited to 'gdb/m2-exp.y')
-rw-r--r--gdb/m2-exp.y29
1 files changed, 14 insertions, 15 deletions
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index d932e1671f3..3f833237048 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -105,11 +105,13 @@ int
yyparse PARAMS ((void));
/* The sign of the number being parsed. */
-int number_sign = 1;
+static int number_sign = 1;
/* The block that the module specified by the qualifer on an identifer is
contained in, */
-struct block *modblock=0;
+#if 0
+static struct block *modblock=0;
+#endif
/* #define YYDEBUG 1 */
%}
@@ -174,7 +176,7 @@ struct block *modblock=0;
%nonassoc ASSIGN
%left '<' '>' LEQ GEQ '=' NOTEQUAL '#' IN
%left OROR
-%left ANDAND '&'
+%left LOGICAL_AND '&'
%left '@'
%left '+' '-'
%left '*' '/' DIV MOD
@@ -217,7 +219,7 @@ exp : '+' exp %prec UNARY
;
exp : not_exp exp %prec UNARY
- { write_exp_elt_opcode (UNOP_ZEROP); }
+ { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
;
not_exp : NOT
@@ -444,16 +446,12 @@ exp : exp '>' exp
{ write_exp_elt_opcode (BINOP_GTR); }
;
-exp : exp ANDAND exp
- { write_exp_elt_opcode (BINOP_AND); }
- ;
-
-exp : exp '&' exp
- { write_exp_elt_opcode (BINOP_AND); }
+exp : exp LOGICAL_AND exp
+ { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
;
exp : exp OROR exp
- { write_exp_elt_opcode (BINOP_OR); }
+ { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
;
exp : exp ASSIGN exp
@@ -813,7 +811,7 @@ static struct keyword keytab[] =
{
{"OR" , OROR },
{"IN", IN },/* Note space after IN */
- {"AND", ANDAND },
+ {"AND", LOGICAL_AND},
{"ABS", ABS },
{"CHR", CHR },
{"DEC", DEC },
@@ -1189,9 +1187,9 @@ const static struct op_print m2_op_print_tab[] = {
{"DIV", BINOP_INTDIV, PREC_MUL, 0},
{"MOD", BINOP_REM, PREC_MUL, 0},
{":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
- {"OR", BINOP_OR, PREC_OR, 0},
- {"AND", BINOP_AND, PREC_AND, 0},
- {"NOT", UNOP_ZEROP, PREC_PREFIX, 0},
+ {"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
+ {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
+ {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
{"=", BINOP_EQUAL, PREC_EQUAL, 0},
{"<>", BINOP_NOTEQUAL, PREC_EQUAL, 0},
{"<=", BINOP_LEQ, PREC_ORDER, 0},
@@ -1200,6 +1198,7 @@ const static struct op_print m2_op_print_tab[] = {
{"<", BINOP_LESS, PREC_ORDER, 0},
{"^", UNOP_IND, PREC_PREFIX, 0},
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
+ {NULL, 0, 0, 0}
};
/* The built-in types of Modula-2. */