Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Build Warnigns/Errors #27

Open
elliottcstr opened this issue Apr 30, 2019 · 2 comments
Open

Build Warnigns/Errors #27

elliottcstr opened this issue Apr 30, 2019 · 2 comments

Comments

@elliottcstr
Copy link

elliottcstr commented Apr 30, 2019

Issue Description

Many rule warnings (errors) that need addressing

What should happen:

No/Less Warnings

What actually happens:

Warnings

verilog-parser/src/verilog_parser.y:165.17-29: warning: symbol binary_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> binary_number
                 ^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:164.17-30: warning: symbol decimal_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> decimal_number
                 ^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:166.17-26: warning: symbol hex_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> hex_number
                 ^^^^^^^^^^
verilog-parser/src/verilog_parser.y:167.17-28: warning: symbol octal_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> octal_number
                 ^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:168.17-27: warning: symbol real_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> real_number
                 ^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:821.28-42: warning: type clash on default action: <list> != <node> [-Wother]
 list_of_actual_arguments : actual_argument
                            ^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:825.19-28: warning: type clash on default action: <node> != <expression> [-Wother]
 actual_argument : expression
                   ^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3703.27-47: warning: type clash on default action: <node> != <parameter_declaration> [-Wother]
 specify_item            : specparam_declaration
                           ^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3706.27-42: warning: type clash on default action: <node> != <path_declaration> [-Wother]
                         | path_declaration
                           ^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3710.27-78: warning: type clash on default action: <node> != <keyword> [-Wother]
 pulsestyle_declaration  : KW_PULSESTYLE_ONEVENT list_of_path_outputs SEMICOLON
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3711.27-79: warning: type clash on default action: <node> != <keyword> [-Wother]
                         | KW_PULSESTYLE_ONDETECT list_of_path_outputs SEMICOLON
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3714.31-77: warning: type clash on default action: <node> != <keyword> [-Wother]
 showcancelled_declaration   : KW_SHOWCANCELLED list_of_path_outputs SEMICOLON
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3715.31-79: warning: type clash on default action: <node> != <keyword> [-Wother]
                             | KW_NOSHOWCANCELLED list_of_path_outputs SEMICOLON
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:4535.3-54: warning: type clash on default action: <list> != <string> [-Wother]
   OPEN_SQ_BRACKET constant_expression CLOSE_SQ_BRACKET
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:4536.3-4537.33: warning: type clash on default action: <list> != <string> [-Wother]
 | OPEN_SQ_BRACKET constant_expression CLOSE_SQ_BRACKET
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y: warning: 11 nonterminals useless in grammar [-Wother]
verilog-parser/src/verilog_parser.y: warning: 11 rules useless in grammar [-Wother]
verilog-parser/src/verilog_parser.y:542.38-50: warning: nonterminal useless in grammar: expressions_o [-Wother]
 %type   <list>                       expressions_o
                                      ^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:716.38-44: warning: nonterminal useless in grammar: comment [-Wother]
 %type   <string>                     comment
                                      ^^^^^^^
verilog-parser/src/verilog_parser.y:720.38-53: warning: nonterminal useless in grammar: one_line_comment [-Wother]
 %type   <string>                     one_line_comment
                                      ^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:715.38-50: warning: nonterminal useless in grammar: block_comment [-Wother]
 %type   <string>                     block_comment
                                      ^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:714.38-41: warning: nonterminal useless in grammar: anys [-Wother]
 %type   <string>                     anys
                                      ^^^^
verilog-parser/src/verilog_parser.y:722.38-48: warning: nonterminal useless in grammar: white_space [-Wother]
 %type   <string>                     white_space
                                      ^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:165.17-29: warning: nonterminal useless in grammar: binary_number [-Wother]
 %type  <number> binary_number
                 ^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:164.17-30: warning: nonterminal useless in grammar: decimal_number [-Wother]
 %type  <number> decimal_number
                 ^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:166.17-26: warning: nonterminal useless in grammar: hex_number [-Wother]
 %type  <number> hex_number
                 ^^^^^^^^^^
verilog-parser/src/verilog_parser.y:167.17-28: warning: nonterminal useless in grammar: octal_number [-Wother]
 %type  <number> octal_number
                 ^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:168.17-27: warning: nonterminal useless in grammar: real_number [-Wother]
 %type  <number> real_number
                 ^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3566.19-40: warning: rule useless in grammar [-Wother]
 expressions_o   : expressions {$$ = $1;} |{$$=ast_list_new();}
                   ^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3566.43-62: warning: rule useless in grammar [-Wother]
 expressions_o   : expressions {$$ = $1;} |{$$=ast_list_new();}
verilog-parser/src/verilog_parser.y:165.17-29: warning: symbol binary_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> binary_number
                 ^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:164.17-30: warning: symbol decimal_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> decimal_number
                 ^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:166.17-26: warning: symbol hex_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> hex_number
                 ^^^^^^^^^^
verilog-parser/src/verilog_parser.y:167.17-28: warning: symbol octal_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> octal_number
                 ^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:168.17-27: warning: symbol real_number is used, but is not defined as a token and has no rules [-Wother]
 %type  <number> real_number
                 ^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:821.28-42: warning: type clash on default action: <list> != <node> [-Wother]
 list_of_actual_arguments : actual_argument
                            ^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:825.19-28: warning: type clash on default action: <node> != <expression> [-Wother]
 actual_argument : expression
                   ^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3703.27-47: warning: type clash on default action: <node> != <parameter_declaration> [-Wother]
 specify_item            : specparam_declaration
                           ^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3706.27-42: warning: type clash on default action: <node> != <path_declaration> [-Wother]
                         | path_declaration
                           ^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3710.27-78: warning: type clash on default action: <node> != <keyword> [-Wother]
 pulsestyle_declaration  : KW_PULSESTYLE_ONEVENT list_of_path_outputs SEMICOLON
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3711.27-79: warning: type clash on default action: <node> != <keyword> [-Wother]
                         | KW_PULSESTYLE_ONDETECT list_of_path_outputs SEMICOLON
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3714.31-77: warning: type clash on default action: <node> != <keyword> [-Wother]
 showcancelled_declaration   : KW_SHOWCANCELLED list_of_path_outputs SEMICOLON
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3715.31-79: warning: type clash on default action: <node> != <keyword> [-Wother]
                             | KW_NOSHOWCANCELLED list_of_path_outputs SEMICOLON
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:4535.3-54: warning: type clash on default action: <list> != <string> [-Wother]
   OPEN_SQ_BRACKET constant_expression CLOSE_SQ_BRACKET
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:4536.3-4537.33: warning: type clash on default action: <list> != <string> [-Wother]
 | OPEN_SQ_BRACKET constant_expression CLOSE_SQ_BRACKET
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y: warning: 11 nonterminals useless in grammar [-Wother]
verilog-parser/src/verilog_parser.y: warning: 11 rules useless in grammar [-Wother]
verilog-parser/src/verilog_parser.y:542.38-50: warning: nonterminal useless in grammar: expressions_o [-Wother]
 %type   <list>                       expressions_o
                                      ^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:716.38-44: warning: nonterminal useless in grammar: comment [-Wother]
 %type   <string>                     comment
                                      ^^^^^^^
verilog-parser/src/verilog_parser.y:720.38-53: warning: nonterminal useless in grammar: one_line_comment [-Wother]
 %type   <string>                     one_line_comment
                                      ^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:715.38-50: warning: nonterminal useless in grammar: block_comment [-Wother]
 %type   <string>                     block_comment
                                      ^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:714.38-41: warning: nonterminal useless in grammar: anys [-Wother]
 %type   <string>                     anys
                                      ^^^^
verilog-parser/src/verilog_parser.y:722.38-48: warning: nonterminal useless in grammar: white_space [-Wother]
 %type   <string>                     white_space
                                      ^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:165.17-29: warning: nonterminal useless in grammar: binary_number [-Wother]
 %type  <number> binary_number
                 ^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:164.17-30: warning: nonterminal useless in grammar: decimal_number [-Wother]
 %type  <number> decimal_number
                 ^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:166.17-26: warning: nonterminal useless in grammar: hex_number [-Wother]
 %type  <number> hex_number
                 ^^^^^^^^^^
verilog-parser/src/verilog_parser.y:167.17-28: warning: nonterminal useless in grammar: octal_number [-Wother]
 %type  <number> octal_number
                 ^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:168.17-27: warning: nonterminal useless in grammar: real_number [-Wother]
 %type  <number> real_number
                 ^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3566.19-40: warning: rule useless in grammar [-Wother]
 expressions_o   : expressions {$$ = $1;} |{$$=ast_list_new();}
                   ^^^^^^^^^^^^^^^^^^^^^^
verilog-parser/src/verilog_parser.y:3566.43-62: warning: rule useless in grammar [-Wother]
 expressions_o   : expressions {$$ = $1;} |{$$=ast_list_new();}

...only first terminal screen pasted here

Steps to re-create:

bison==3.0.4
flex==2.6.4
(ubuntu-bionic packages)

$> make clean
$> make debug

People to Notify:

Related Issues:

@ben-marshall
Copy link
Owner

Hi @elliottcstr

Thanks for this. I'm painfully aware about the number of parser warnings generated.

I built this thing years ago so my memory is not especially fresh. However, many of the warnings stem from how I wrote the grammar. I wrote it to be almost identical to how the grammar is specified in BNF in the IEEE specification document. The aim of the project being to make it as clear as possible how the bison code related to the specification.

A warning from bison about things like useless rules implies some redundency in how the IEEE BNF grammar is specified. I didn't / still dont' have enough confidence about parser engineering to refactor that amount of stuff away. As you say, there are many warnings, some of which are no doubt solely my own fault.

In terms of fixing this:

  • It's a big job which I'm not confident I have the skills or time to do. I'm very happy accepting pull requests, but I don't have time to sink into this project any more. I'll always respond to issues though.

@elliottcstr
Copy link
Author

@ben-marshall

Roger that. I too, am building a flex/bison parser from the IEEE spec and was looking for any projects to get started. Just wanted to document for onlookers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants