Skip to content

Commit 526d08b

Browse files
committed
Merge branch 'bison3.3.1'
2 parents e48c5cf + 5ab260c commit 526d08b

File tree

143 files changed

+10547
-5654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+10547
-5654
lines changed

.appveyor.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,8 @@ environment:
1313
matrix:
1414
- VSVERSION: "15 2017"
1515
- VSVERSION: "14 2015"
16-
- VSVERSION: "12 2013"
1716
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
1817

19-
matrix:
20-
exclude:
21-
- VSVERSION: "12 2013"
22-
platform: x64
23-
- VSVERSION: "12 2013"
24-
configuration: Debug
25-
2618
init:
2719
- cmake --version
2820
- msbuild /version

VS2017/common_lib/common_lib.vcxproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
<ClInclude Include="..\..\common\m4\lib\gl_anylinked_list1.h" />
9797
<ClInclude Include="..\..\common\m4\lib\gl_anylinked_list2.h" />
9898
<ClInclude Include="..\..\common\m4\lib\gl_anytree_oset.h" />
99+
<ClInclude Include="..\..\common\m4\lib\gl_array_list.h" />
99100
<ClInclude Include="..\..\common\m4\lib\gl_avltree_oset.h" />
100101
<ClInclude Include="..\..\common\m4\lib\gl_linkedhash_list.h" />
101102
<ClInclude Include="..\..\common\m4\lib\gl_list.h" />
@@ -128,6 +129,7 @@
128129
<ClInclude Include="..\..\common\m4\lib\xvasprintf.h" />
129130
<ClInclude Include="..\..\common\m4\m4.h" />
130131
<ClInclude Include="..\..\common\misc\abitset.h" />
132+
<ClInclude Include="..\..\common\misc\arg-nonnull.h" />
131133
<ClInclude Include="..\..\common\misc\argmatch.h" />
132134
<ClInclude Include="..\..\common\misc\bbitset.h" />
133135
<ClInclude Include="..\..\common\misc\bitrotate.h" />
@@ -139,28 +141,35 @@
139141
<ClInclude Include="..\..\common\misc\c-strcase.h" />
140142
<ClInclude Include="..\..\common\misc\c-strcaseeq.h" />
141143
<ClInclude Include="..\..\common\misc\cjk.h" />
144+
<ClInclude Include="..\..\common\misc\concat-filename.h" />
142145
<ClInclude Include="..\..\common\misc\config.h" />
143146
<ClInclude Include="..\..\common\misc\dirname.h" />
144147
<ClInclude Include="..\..\common\misc\dosname.h" />
145148
<ClInclude Include="..\..\common\misc\ebitset.h" />
146149
<ClInclude Include="..\..\common\misc\error.h" />
147150
<ClInclude Include="..\..\common\misc\exitfail.h" />
151+
<ClInclude Include="..\..\common\misc\filename.h" />
148152
<ClInclude Include="..\..\common\misc\get-errno.h" />
153+
<ClInclude Include="..\..\common\misc\gethrxtime.h" />
149154
<ClInclude Include="..\..\common\misc\getopt.h" />
150155
<ClInclude Include="..\..\common\misc\getopt_int.h" />
151156
<ClInclude Include="..\..\common\misc\gettext.h" />
152157
<ClInclude Include="..\..\common\misc\hash.h" />
153158
<ClInclude Include="..\..\common\misc\lbitset.h" />
159+
<ClInclude Include="..\..\common\misc\libiberty.h" />
154160
<ClInclude Include="..\..\common\misc\localcharset.h" />
155161
<ClInclude Include="..\..\common\misc\mbswidth.h" />
156162
<ClInclude Include="..\..\common\misc\obstack.h" />
163+
<ClInclude Include="..\..\common\misc\path-join.h" />
157164
<ClInclude Include="..\..\common\misc\progname.h" />
158165
<ClInclude Include="..\..\common\misc\quote.h" />
159166
<ClInclude Include="..\..\common\misc\quotearg.h" />
167+
<ClInclude Include="..\..\common\misc\relocatable.h" />
160168
<ClInclude Include="..\..\common\misc\stdbool.h" />
161169
<ClInclude Include="..\..\common\misc\stdio-safer.h" />
162170
<ClInclude Include="..\..\common\misc\streq.h" />
163171
<ClInclude Include="..\..\common\misc\system.h" />
172+
<ClInclude Include="..\..\common\misc\timespec.h" />
164173
<ClInclude Include="..\..\common\misc\timevar.h" />
165174
<ClInclude Include="..\..\common\misc\unitypes.in.h" />
166175
<ClInclude Include="..\..\common\misc\uniwidth.in.h" />
@@ -169,6 +178,7 @@
169178
<ClInclude Include="..\..\common\misc\xalloc.h" />
170179
<ClInclude Include="..\..\common\misc\xmemdup0.h" />
171180
<ClInclude Include="..\..\common\misc\xstrndup.h" />
181+
<ClInclude Include="..\..\common\misc\xtime.h" />
172182
</ItemGroup>
173183
<ItemGroup>
174184
<ClCompile Include="..\..\common\m4\builtin.c" />
@@ -188,6 +198,7 @@
188198
<ClCompile Include="..\..\common\m4\lib\execute.c" />
189199
<ClCompile Include="..\..\common\m4\lib\fd-safer.c" />
190200
<ClCompile Include="..\..\common\m4\lib\filenamecat-lgpl.c" />
201+
<ClCompile Include="..\..\common\m4\lib\gl_array_list.c" />
191202
<ClCompile Include="..\..\common\m4\lib\gl_avltree_oset.c" />
192203
<ClCompile Include="..\..\common\m4\lib\gl_linkedhash_list.c" />
193204
<ClCompile Include="..\..\common\m4\lib\gl_list.c" />
@@ -234,13 +245,15 @@
234245
<ClCompile Include="..\..\common\misc\c-ctype.c" />
235246
<ClCompile Include="..\..\common\misc\c-strcasecmp.c" />
236247
<ClCompile Include="..\..\common\misc\c-strncasecmp.c" />
248+
<ClCompile Include="..\..\common\misc\concat-filename.c" />
237249
<ClCompile Include="..\..\common\misc\dirname-lgpl.c" />
238250
<ClCompile Include="..\..\common\misc\dirname.c" />
239251
<ClCompile Include="..\..\common\misc\ebitset.c" />
240252
<ClCompile Include="..\..\common\misc\error.c" />
241253
<ClCompile Include="..\..\common\misc\exitfail.c" />
242254
<ClCompile Include="..\..\common\misc\get-errno.c" />
243255
<ClCompile Include="..\..\common\misc\getdelim.c" />
256+
<ClCompile Include="..\..\common\misc\gethrxtime.c" />
244257
<ClCompile Include="..\..\common\misc\getline.c" />
245258
<ClCompile Include="..\..\common\misc\getopt.c" />
246259
<ClCompile Include="..\..\common\misc\getopt1.c" />
@@ -250,17 +263,22 @@
250263
<ClCompile Include="..\..\common\misc\mbswidth.c" />
251264
<ClCompile Include="..\..\common\misc\obstack.c" />
252265
<ClCompile Include="..\..\common\misc\obstack_printf.c" />
266+
<ClCompile Include="..\..\common\misc\path-join.c" />
253267
<ClCompile Include="..\..\common\misc\progname.c" />
254268
<ClCompile Include="..\..\common\misc\quotearg.c" />
269+
<ClCompile Include="..\..\common\misc\relocatable.c" />
255270
<ClCompile Include="..\..\common\misc\strverscmp.c" />
271+
<ClCompile Include="..\..\common\misc\timespec.c" />
256272
<ClCompile Include="..\..\common\misc\timevar.c" />
257273
<ClCompile Include="..\..\common\misc\vbitset.c" />
258274
<ClCompile Include="..\..\common\misc\wcwidth.c" />
259275
<ClCompile Include="..\..\common\misc\width.c" />
260276
<ClCompile Include="..\..\common\misc\xalloc-die.c" />
277+
<ClCompile Include="..\..\common\misc\xconcat-filename.c" />
261278
<ClCompile Include="..\..\common\misc\xmalloc.c" />
262279
<ClCompile Include="..\..\common\misc\xmemdup0.c" />
263280
<ClCompile Include="..\..\common\misc\xstrndup.c" />
281+
<ClCompile Include="..\..\common\misc\xtime.c" />
264282
</ItemGroup>
265283
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
266284
<ImportGroup Label="ExtensionTargets">

VS2017/common_lib/common_lib.vcxproj.filters

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,36 @@
300300
<ClInclude Include="..\..\common\misc\xstrndup.h">
301301
<Filter>Header Files\misc</Filter>
302302
</ClInclude>
303+
<ClInclude Include="..\..\common\misc\arg-nonnull.h">
304+
<Filter>Header Files\misc</Filter>
305+
</ClInclude>
306+
<ClInclude Include="..\..\common\misc\concat-filename.h">
307+
<Filter>Header Files\misc</Filter>
308+
</ClInclude>
309+
<ClInclude Include="..\..\common\misc\filename.h">
310+
<Filter>Header Files\misc</Filter>
311+
</ClInclude>
312+
<ClInclude Include="..\..\common\misc\gethrxtime.h">
313+
<Filter>Header Files\misc</Filter>
314+
</ClInclude>
315+
<ClInclude Include="..\..\common\misc\libiberty.h">
316+
<Filter>Header Files\misc</Filter>
317+
</ClInclude>
318+
<ClInclude Include="..\..\common\misc\path-join.h">
319+
<Filter>Header Files\misc</Filter>
320+
</ClInclude>
321+
<ClInclude Include="..\..\common\misc\relocatable.h">
322+
<Filter>Header Files\misc</Filter>
323+
</ClInclude>
324+
<ClInclude Include="..\..\common\misc\timespec.h">
325+
<Filter>Header Files\misc</Filter>
326+
</ClInclude>
327+
<ClInclude Include="..\..\common\misc\xtime.h">
328+
<Filter>Header Files\misc</Filter>
329+
</ClInclude>
330+
<ClInclude Include="..\..\common\m4\lib\gl_array_list.h">
331+
<Filter>Header Files\m4\lib</Filter>
332+
</ClInclude>
303333
</ItemGroup>
304334
<ItemGroup>
305335
<ClCompile Include="..\..\common\m4\lib\clean-temp.c">
@@ -545,5 +575,29 @@
545575
<ClCompile Include="..\..\common\m4\symtab.c">
546576
<Filter>Source Files\m4</Filter>
547577
</ClCompile>
578+
<ClCompile Include="..\..\common\misc\concat-filename.c">
579+
<Filter>Source Files\misc</Filter>
580+
</ClCompile>
581+
<ClCompile Include="..\..\common\misc\gethrxtime.c">
582+
<Filter>Source Files\misc</Filter>
583+
</ClCompile>
584+
<ClCompile Include="..\..\common\misc\path-join.c">
585+
<Filter>Source Files\misc</Filter>
586+
</ClCompile>
587+
<ClCompile Include="..\..\common\misc\relocatable.c">
588+
<Filter>Source Files\misc</Filter>
589+
</ClCompile>
590+
<ClCompile Include="..\..\common\misc\timespec.c">
591+
<Filter>Source Files\misc</Filter>
592+
</ClCompile>
593+
<ClCompile Include="..\..\common\misc\xconcat-filename.c">
594+
<Filter>Source Files\misc</Filter>
595+
</ClCompile>
596+
<ClCompile Include="..\..\common\misc\xtime.c">
597+
<Filter>Source Files\misc</Filter>
598+
</ClCompile>
599+
<ClCompile Include="..\..\common\m4\lib\gl_array_list.c">
600+
<Filter>Source Files\m4\lib</Filter>
601+
</ClCompile>
548602
</ItemGroup>
549603
</Project>

VS2017/win_bison/win_bison.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ xcopy "$(ProjectDir)..\..\bison\data\*" "$(TargetDir)\data" /s /i /y</Command>
110110
<ClCompile Include="..\..\bison\src\conflicts.c" />
111111
<ClCompile Include="..\..\bison\src\derives.c" />
112112
<ClCompile Include="..\..\bison\src\files.c" />
113+
<ClCompile Include="..\..\bison\src\fixits.c" />
113114
<ClCompile Include="..\..\bison\src\getargs.c" />
114115
<ClCompile Include="..\..\bison\src\gram.c" />
115116
<ClCompile Include="..\..\bison\src\graphviz.c" />
@@ -149,6 +150,7 @@ xcopy "$(ProjectDir)..\..\bison\data\*" "$(TargetDir)\data" /s /i /y</Command>
149150
<ClInclude Include="..\..\bison\src\conflicts.h" />
150151
<ClInclude Include="..\..\bison\src\derives.h" />
151152
<ClInclude Include="..\..\bison\src\files.h" />
153+
<ClInclude Include="..\..\bison\src\fixits.h" />
152154
<ClInclude Include="..\..\bison\src\flex-scanner.h" />
153155
<ClInclude Include="..\..\bison\src\getargs.h" />
154156
<ClInclude Include="..\..\bison\src\gram.h" />

VS2017/win_bison/win_bison.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@
123123
<ClCompile Include="..\..\bison\src\uniqstr.c">
124124
<Filter>Source Files</Filter>
125125
</ClCompile>
126+
<ClCompile Include="..\..\bison\src\fixits.c">
127+
<Filter>Source Files</Filter>
128+
</ClCompile>
126129
</ItemGroup>
127130
<ItemGroup>
128131
<ClInclude Include="..\..\bison\src\AnnotationList.h">
@@ -239,5 +242,8 @@
239242
<ClInclude Include="..\..\bison\src\uniqstr.h">
240243
<Filter>Header Files</Filter>
241244
</ClInclude>
245+
<ClInclude Include="..\..\bison\src\fixits.h">
246+
<Filter>Header Files</Filter>
247+
</ClInclude>
242248
</ItemGroup>
243249
</Project>

bison/data/README

Lines changed: 108 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
This directory contains data needed by Bison.
22

3-
* Skeletons
4-
Bison skeletons: the general shapes of the different parser kinds,
5-
that are specialized for specific grammars by the bison program.
3+
# Directory content
4+
## Skeletons
5+
Bison skeletons: the general shapes of the different parser kinds, that are
6+
specialized for specific grammars by the bison program.
67

78
Currently, the supported skeletons are:
89

@@ -22,19 +23,18 @@ Currently, the supported skeletons are:
2223
- glr.cc
2324
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
2425

25-
These skeletons are the only ones supported by the Bison team.
26-
Because the interface between skeletons and the bison program is not
27-
finished, *we are not bound to it*. In particular, Bison is not
28-
mature enough for us to consider that "foreign skeletons" are
29-
supported.
26+
These skeletons are the only ones supported by the Bison team. Because the
27+
interface between skeletons and the bison program is not finished, *we are
28+
not bound to it*. In particular, Bison is not mature enough for us to
29+
consider that "foreign skeletons" are supported.
3030

31-
* m4sugar
32-
This directory contains M4sugar, sort of an extended library for M4,
33-
which is used by Bison to instantiate the skeletons.
31+
## m4sugar
32+
This directory contains M4sugar, sort of an extended library for M4, which
33+
is used by Bison to instantiate the skeletons.
3434

35-
* xslt
36-
This directory contains XSLT programs that transform Bison's XML output
37-
into various formats.
35+
## xslt
36+
This directory contains XSLT programs that transform Bison's XML output into
37+
various formats.
3838

3939
- bison.xsl
4040
A library of routines used by the other XSLT programs.
@@ -48,13 +48,105 @@ into various formats.
4848
- xml2xhtml.xsl
4949
Conversion into XHTML.
5050

51+
# Implementation note about the skeletons
52+
53+
"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison
54+
executable with LR tables, facts about the symbols, etc. and they generate
55+
the output (say parser.cc, parser.hh, location.hh, etc.). They are only in
56+
charge of generating the parser and its auxiliary files, they do not
57+
generate the XML output, the parser.output reports, nor the graphical
58+
rendering.
59+
60+
The bits of information passing from bison to the backend is named
61+
"muscles". Muscles are passed to M4 via its standard input: it's a set of
62+
m4 definitions. To see them, use `--trace=muscles`.
63+
64+
Except for muscles, whose names are generated by bison, the skeletons have
65+
no constraint at all on the macro names: there is no technical/theoretical
66+
limitation, as long as you generate the output, you can do what you want.
67+
However, of course, that would be a bad idea if, say, the C and C++
68+
skeletons used different approaches and had completely different
69+
implementations. That would be a maintenance nightmare.
70+
71+
Below, we document some of the macros that we use in several of the
72+
skeletons. If you are to write a new skeleton, please, implement them for
73+
your language. Overall, be sure to follow the same patterns as the existing
74+
skeletons.
75+
76+
## Symbols
77+
78+
In order to unify the handling of the various aspects of symbols (tag, type
79+
name, whether terminal, etc.), bison.exe defines one macro per (token,
80+
field), where field can `has_id`, `id`, etc.: see
81+
src/output.c:prepare_symbols_definitions().
82+
83+
The various FIELDS are:
84+
85+
- has_id: 0 or 1.
86+
Whether the symbol has an id.
87+
- id: string
88+
If has_id, the id. Guaranteed to be usable as a C identifier.
89+
Prefixed by api.token.prefix if defined.
90+
- tag: string.
91+
A representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
92+
- user_number: integer
93+
The external number as used by yylex. Can be ASCII code when a character,
94+
some number chosen by bison, or some user number in the case of
95+
%token FOO <NUM>. Corresponds to yychar in yacc.c.
96+
- is_token: 0 or 1
97+
Whether this is a terminal symbol.
98+
- number: integer
99+
The internal number (computed from the external number by yytranslate).
100+
Corresponds to yytoken in yacc.c. This is the same number that serves as
101+
key in b4_symbol(NUM, FIELD).
102+
- has_type: 0, 1
103+
Whether has a semantic value.
104+
- type_tag: string
105+
When api.value.type=union, the generated name for the union member.
106+
yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
107+
- type
108+
If it has a semantic value, its type tag, or, if variant are used,
109+
its type.
110+
In the case of api.value.type=union, type is the real type (e.g. int).
111+
- has_printer: 0, 1
112+
- printer: string
113+
- printer_file: string
114+
- printer_line: integer
115+
If the symbol has a printer, everything about it.
116+
- has_destructor, destructor, destructor_file, destructor_line
117+
Likewise.
118+
119+
### b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
120+
Expansion of $$, $1, $<TYPE-TAG>3, etc.
121+
122+
The semantic value from a given VAL.
123+
- `VAL`: some semantic value storage (typically a union). e.g., `yylval`
124+
- `SYMBOL-NUM`: the symbol number from which we extract the type tag.
125+
- `TYPE-TAG`, the user forced the `<TYPE-TAG>`.
126+
127+
The result can be used safely, it is put in parens to avoid nasty precedence
128+
issues.
129+
130+
### b4_lhs_value(SYMBOL-NUM, [TYPE])
131+
Expansion of `$$` or `$<TYPE>$`, for symbol `SYMBOL-NUM`.
132+
133+
### b4_rhs_data(RULE-LENGTH, POS)
134+
The data corresponding to the symbol `#POS`, where the current rule has
135+
`RULE-LENGTH` symbols on RHS.
136+
137+
### b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
138+
Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
139+
on RHS.
140+
51141
-----
52142

53143
Local Variables:
54-
mode: outline
144+
mode: markdown
145+
fill-column: 76
146+
ispell-dictionary: "american"
55147
End:
56148

57-
Copyright (C) 2002, 2008-2015, 2018 Free Software Foundation, Inc.
149+
Copyright (C) 2002, 2008-2015, 2018-2019 Free Software Foundation, Inc.
58150

59151
This file is part of GNU Bison.
60152

0 commit comments

Comments
 (0)