Skip to content

Commit

Permalink
Merge branch 'bison3.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lexxmark committed Feb 20, 2019
2 parents e48c5cf + 5ab260c commit 526d08b
Show file tree
Hide file tree
Showing 143 changed files with 10,547 additions and 5,654 deletions.
8 changes: 0 additions & 8 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@ environment:
matrix:
- VSVERSION: "15 2017"
- VSVERSION: "14 2015"
- VSVERSION: "12 2013"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015

matrix:
exclude:
- VSVERSION: "12 2013"
platform: x64
- VSVERSION: "12 2013"
configuration: Debug

init:
- cmake --version
- msbuild /version
Expand Down
18 changes: 18 additions & 0 deletions VS2017/common_lib/common_lib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<ClInclude Include="..\..\common\m4\lib\gl_anylinked_list1.h" />
<ClInclude Include="..\..\common\m4\lib\gl_anylinked_list2.h" />
<ClInclude Include="..\..\common\m4\lib\gl_anytree_oset.h" />
<ClInclude Include="..\..\common\m4\lib\gl_array_list.h" />
<ClInclude Include="..\..\common\m4\lib\gl_avltree_oset.h" />
<ClInclude Include="..\..\common\m4\lib\gl_linkedhash_list.h" />
<ClInclude Include="..\..\common\m4\lib\gl_list.h" />
Expand Down Expand Up @@ -128,6 +129,7 @@
<ClInclude Include="..\..\common\m4\lib\xvasprintf.h" />
<ClInclude Include="..\..\common\m4\m4.h" />
<ClInclude Include="..\..\common\misc\abitset.h" />
<ClInclude Include="..\..\common\misc\arg-nonnull.h" />
<ClInclude Include="..\..\common\misc\argmatch.h" />
<ClInclude Include="..\..\common\misc\bbitset.h" />
<ClInclude Include="..\..\common\misc\bitrotate.h" />
Expand All @@ -139,28 +141,35 @@
<ClInclude Include="..\..\common\misc\c-strcase.h" />
<ClInclude Include="..\..\common\misc\c-strcaseeq.h" />
<ClInclude Include="..\..\common\misc\cjk.h" />
<ClInclude Include="..\..\common\misc\concat-filename.h" />
<ClInclude Include="..\..\common\misc\config.h" />
<ClInclude Include="..\..\common\misc\dirname.h" />
<ClInclude Include="..\..\common\misc\dosname.h" />
<ClInclude Include="..\..\common\misc\ebitset.h" />
<ClInclude Include="..\..\common\misc\error.h" />
<ClInclude Include="..\..\common\misc\exitfail.h" />
<ClInclude Include="..\..\common\misc\filename.h" />
<ClInclude Include="..\..\common\misc\get-errno.h" />
<ClInclude Include="..\..\common\misc\gethrxtime.h" />
<ClInclude Include="..\..\common\misc\getopt.h" />
<ClInclude Include="..\..\common\misc\getopt_int.h" />
<ClInclude Include="..\..\common\misc\gettext.h" />
<ClInclude Include="..\..\common\misc\hash.h" />
<ClInclude Include="..\..\common\misc\lbitset.h" />
<ClInclude Include="..\..\common\misc\libiberty.h" />
<ClInclude Include="..\..\common\misc\localcharset.h" />
<ClInclude Include="..\..\common\misc\mbswidth.h" />
<ClInclude Include="..\..\common\misc\obstack.h" />
<ClInclude Include="..\..\common\misc\path-join.h" />
<ClInclude Include="..\..\common\misc\progname.h" />
<ClInclude Include="..\..\common\misc\quote.h" />
<ClInclude Include="..\..\common\misc\quotearg.h" />
<ClInclude Include="..\..\common\misc\relocatable.h" />
<ClInclude Include="..\..\common\misc\stdbool.h" />
<ClInclude Include="..\..\common\misc\stdio-safer.h" />
<ClInclude Include="..\..\common\misc\streq.h" />
<ClInclude Include="..\..\common\misc\system.h" />
<ClInclude Include="..\..\common\misc\timespec.h" />
<ClInclude Include="..\..\common\misc\timevar.h" />
<ClInclude Include="..\..\common\misc\unitypes.in.h" />
<ClInclude Include="..\..\common\misc\uniwidth.in.h" />
Expand All @@ -169,6 +178,7 @@
<ClInclude Include="..\..\common\misc\xalloc.h" />
<ClInclude Include="..\..\common\misc\xmemdup0.h" />
<ClInclude Include="..\..\common\misc\xstrndup.h" />
<ClInclude Include="..\..\common\misc\xtime.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\common\m4\builtin.c" />
Expand All @@ -188,6 +198,7 @@
<ClCompile Include="..\..\common\m4\lib\execute.c" />
<ClCompile Include="..\..\common\m4\lib\fd-safer.c" />
<ClCompile Include="..\..\common\m4\lib\filenamecat-lgpl.c" />
<ClCompile Include="..\..\common\m4\lib\gl_array_list.c" />
<ClCompile Include="..\..\common\m4\lib\gl_avltree_oset.c" />
<ClCompile Include="..\..\common\m4\lib\gl_linkedhash_list.c" />
<ClCompile Include="..\..\common\m4\lib\gl_list.c" />
Expand Down Expand Up @@ -234,13 +245,15 @@
<ClCompile Include="..\..\common\misc\c-ctype.c" />
<ClCompile Include="..\..\common\misc\c-strcasecmp.c" />
<ClCompile Include="..\..\common\misc\c-strncasecmp.c" />
<ClCompile Include="..\..\common\misc\concat-filename.c" />
<ClCompile Include="..\..\common\misc\dirname-lgpl.c" />
<ClCompile Include="..\..\common\misc\dirname.c" />
<ClCompile Include="..\..\common\misc\ebitset.c" />
<ClCompile Include="..\..\common\misc\error.c" />
<ClCompile Include="..\..\common\misc\exitfail.c" />
<ClCompile Include="..\..\common\misc\get-errno.c" />
<ClCompile Include="..\..\common\misc\getdelim.c" />
<ClCompile Include="..\..\common\misc\gethrxtime.c" />
<ClCompile Include="..\..\common\misc\getline.c" />
<ClCompile Include="..\..\common\misc\getopt.c" />
<ClCompile Include="..\..\common\misc\getopt1.c" />
Expand All @@ -250,17 +263,22 @@
<ClCompile Include="..\..\common\misc\mbswidth.c" />
<ClCompile Include="..\..\common\misc\obstack.c" />
<ClCompile Include="..\..\common\misc\obstack_printf.c" />
<ClCompile Include="..\..\common\misc\path-join.c" />
<ClCompile Include="..\..\common\misc\progname.c" />
<ClCompile Include="..\..\common\misc\quotearg.c" />
<ClCompile Include="..\..\common\misc\relocatable.c" />
<ClCompile Include="..\..\common\misc\strverscmp.c" />
<ClCompile Include="..\..\common\misc\timespec.c" />
<ClCompile Include="..\..\common\misc\timevar.c" />
<ClCompile Include="..\..\common\misc\vbitset.c" />
<ClCompile Include="..\..\common\misc\wcwidth.c" />
<ClCompile Include="..\..\common\misc\width.c" />
<ClCompile Include="..\..\common\misc\xalloc-die.c" />
<ClCompile Include="..\..\common\misc\xconcat-filename.c" />
<ClCompile Include="..\..\common\misc\xmalloc.c" />
<ClCompile Include="..\..\common\misc\xmemdup0.c" />
<ClCompile Include="..\..\common\misc\xstrndup.c" />
<ClCompile Include="..\..\common\misc\xtime.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
54 changes: 54 additions & 0 deletions VS2017/common_lib/common_lib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,36 @@
<ClInclude Include="..\..\common\misc\xstrndup.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\misc\arg-nonnull.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\misc\concat-filename.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\misc\filename.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\misc\gethrxtime.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\misc\libiberty.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\misc\path-join.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\misc\relocatable.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\misc\timespec.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\misc\xtime.h">
<Filter>Header Files\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\common\m4\lib\gl_array_list.h">
<Filter>Header Files\m4\lib</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\common\m4\lib\clean-temp.c">
Expand Down Expand Up @@ -545,5 +575,29 @@
<ClCompile Include="..\..\common\m4\symtab.c">
<Filter>Source Files\m4</Filter>
</ClCompile>
<ClCompile Include="..\..\common\misc\concat-filename.c">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="..\..\common\misc\gethrxtime.c">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="..\..\common\misc\path-join.c">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="..\..\common\misc\relocatable.c">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="..\..\common\misc\timespec.c">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="..\..\common\misc\xconcat-filename.c">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="..\..\common\misc\xtime.c">
<Filter>Source Files\misc</Filter>
</ClCompile>
<ClCompile Include="..\..\common\m4\lib\gl_array_list.c">
<Filter>Source Files\m4\lib</Filter>
</ClCompile>
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions VS2017/win_bison/win_bison.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ xcopy "$(ProjectDir)..\..\bison\data\*" "$(TargetDir)\data" /s /i /y</Command>
<ClCompile Include="..\..\bison\src\conflicts.c" />
<ClCompile Include="..\..\bison\src\derives.c" />
<ClCompile Include="..\..\bison\src\files.c" />
<ClCompile Include="..\..\bison\src\fixits.c" />
<ClCompile Include="..\..\bison\src\getargs.c" />
<ClCompile Include="..\..\bison\src\gram.c" />
<ClCompile Include="..\..\bison\src\graphviz.c" />
Expand Down Expand Up @@ -149,6 +150,7 @@ xcopy "$(ProjectDir)..\..\bison\data\*" "$(TargetDir)\data" /s /i /y</Command>
<ClInclude Include="..\..\bison\src\conflicts.h" />
<ClInclude Include="..\..\bison\src\derives.h" />
<ClInclude Include="..\..\bison\src\files.h" />
<ClInclude Include="..\..\bison\src\fixits.h" />
<ClInclude Include="..\..\bison\src\flex-scanner.h" />
<ClInclude Include="..\..\bison\src\getargs.h" />
<ClInclude Include="..\..\bison\src\gram.h" />
Expand Down
6 changes: 6 additions & 0 deletions VS2017/win_bison/win_bison.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<ClCompile Include="..\..\bison\src\uniqstr.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\bison\src\fixits.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\bison\src\AnnotationList.h">
Expand Down Expand Up @@ -239,5 +242,8 @@
<ClInclude Include="..\..\bison\src\uniqstr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\bison\src\fixits.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
124 changes: 108 additions & 16 deletions bison/data/README
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
This directory contains data needed by Bison.

* Skeletons
Bison skeletons: the general shapes of the different parser kinds,
that are specialized for specific grammars by the bison program.
# Directory content
## Skeletons
Bison skeletons: the general shapes of the different parser kinds, that are
specialized for specific grammars by the bison program.

Currently, the supported skeletons are:

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

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

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

* xslt
This directory contains XSLT programs that transform Bison's XML output
into various formats.
## xslt
This directory contains XSLT programs that transform Bison's XML output into
various formats.

- bison.xsl
A library of routines used by the other XSLT programs.
Expand All @@ -48,13 +48,105 @@ into various formats.
- xml2xhtml.xsl
Conversion into XHTML.

# Implementation note about the skeletons

"Skeleton" in Bison parlance means "backend": a skeleton is fed by the bison
executable with LR tables, facts about the symbols, etc. and they generate
the output (say parser.cc, parser.hh, location.hh, etc.). They are only in
charge of generating the parser and its auxiliary files, they do not
generate the XML output, the parser.output reports, nor the graphical
rendering.

The bits of information passing from bison to the backend is named
"muscles". Muscles are passed to M4 via its standard input: it's a set of
m4 definitions. To see them, use `--trace=muscles`.

Except for muscles, whose names are generated by bison, the skeletons have
no constraint at all on the macro names: there is no technical/theoretical
limitation, as long as you generate the output, you can do what you want.
However, of course, that would be a bad idea if, say, the C and C++
skeletons used different approaches and had completely different
implementations. That would be a maintenance nightmare.

Below, we document some of the macros that we use in several of the
skeletons. If you are to write a new skeleton, please, implement them for
your language. Overall, be sure to follow the same patterns as the existing
skeletons.

## Symbols

In order to unify the handling of the various aspects of symbols (tag, type
name, whether terminal, etc.), bison.exe defines one macro per (token,
field), where field can `has_id`, `id`, etc.: see
src/output.c:prepare_symbols_definitions().

The various FIELDS are:

- has_id: 0 or 1.
Whether the symbol has an id.
- id: string
If has_id, the id. Guaranteed to be usable as a C identifier.
Prefixed by api.token.prefix if defined.
- tag: string.
A representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
- user_number: integer
The external number as used by yylex. Can be ASCII code when a character,
some number chosen by bison, or some user number in the case of
%token FOO <NUM>. Corresponds to yychar in yacc.c.
- is_token: 0 or 1
Whether this is a terminal symbol.
- number: integer
The internal number (computed from the external number by yytranslate).
Corresponds to yytoken in yacc.c. This is the same number that serves as
key in b4_symbol(NUM, FIELD).
- has_type: 0, 1
Whether has a semantic value.
- type_tag: string
When api.value.type=union, the generated name for the union member.
yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
- type
If it has a semantic value, its type tag, or, if variant are used,
its type.
In the case of api.value.type=union, type is the real type (e.g. int).
- has_printer: 0, 1
- printer: string
- printer_file: string
- printer_line: integer
If the symbol has a printer, everything about it.
- has_destructor, destructor, destructor_file, destructor_line
Likewise.

### b4_symbol_value(VAL, [SYMBOL-NUM], [TYPE-TAG])
Expansion of $$, $1, $<TYPE-TAG>3, etc.

The semantic value from a given VAL.
- `VAL`: some semantic value storage (typically a union). e.g., `yylval`
- `SYMBOL-NUM`: the symbol number from which we extract the type tag.
- `TYPE-TAG`, the user forced the `<TYPE-TAG>`.

The result can be used safely, it is put in parens to avoid nasty precedence
issues.

### b4_lhs_value(SYMBOL-NUM, [TYPE])
Expansion of `$$` or `$<TYPE>$`, for symbol `SYMBOL-NUM`.

### b4_rhs_data(RULE-LENGTH, POS)
The data corresponding to the symbol `#POS`, where the current rule has
`RULE-LENGTH` symbols on RHS.

### b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
Expansion of `$<TYPE>POS`, where the current rule has `RULE-LENGTH` symbols
on RHS.

-----

Local Variables:
mode: outline
mode: markdown
fill-column: 76
ispell-dictionary: "american"
End:

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

This file is part of GNU Bison.

Expand Down
Loading

0 comments on commit 526d08b

Please sign in to comment.