2 /* defparse.y - parser for .def files */
4 /* Copyright (C) 1995 Free Software Foundation, Inc.
6 This file is part of GNU Binutils.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
29 %token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA
30 %token SECTIONS, EXPORTS, IMPORTS, VERSION, BASE, CONSTANT
31 %token READ WRITE EXECUTE SHARED NONAME
33 %token <string> STRING
34 %token <number> NUMBER
35 %type <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT attr attr_list opt_number
36 %type <id> opt_name opt_equal_name
45 NAME opt_name opt_base { def_name ($2, $3); }
46 | LIBRARY opt_name opt_base { def_library ($2, $3); }
48 | DESCRIPTION STRING { def_description ($2);}
49 | STACKSIZE NUMBER opt_number { def_stacksize ($2, $3);}
50 | HEAPSIZE NUMBER opt_number { def_heapsize ($2, $3);}
51 | CODE attr_list { def_code ($2);}
52 | DATA attr_list { def_data ($2);}
55 | VERSION NUMBER { def_version ($2,0);}
56 | VERSION NUMBER '.' NUMBER { def_version ($2,$4);}
66 ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT
67 { def_exports ($1, $2, $3, $4, $5);}
75 ID '=' ID '.' ID { def_import ($1,$3,$5);}
76 | ID '.' ID { def_import (0, $1,$3);}
84 ID attr_list { def_section ($1,$2);}
88 attr_list opt_comma attr
96 opt_number: ',' NUMBER { $$=$2;}
116 opt_name: ID { $$ =$1; }
130 opt_base: BASE '=' NUMBER { $$= $3;}