esoule / cproto

Cproto generates function prototypes and variable declarations from C source code. Cproto can also convert function definitions between the old style and the ANSI C style.
7 stars 2 forks source link

grammar.y ambiguity error #1

Open AlexeiKharchev opened 7 months ago

AlexeiKharchev commented 7 months ago

please, help me to solve confict of building cproto from source

I have Linux Mint ( my_system.txt is attached)

bison (GNU Bison) 3.8.2 Copyright (C) 2021 Free Software Foundation, Inc.

I have met erorrs in grammar.y

my actions:

wget https://invisible-island.net/archives/cproto/cproto-4.7v.tgz tar xf cproto-4.7v.tgz cd cproto-4.7v

./configure --prefix=/usr/local $([[ $(which dmalloc) = '/usr' ]] && echo --with-dmalloc) $([[ $(which valgrind) = '/usr' ]] && echo --enable-valgrind) checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu Configuring for linux-gnu checking for gcc... gcc checking for C compiler default output... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for executable suffix... checking for object suffix... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking version of gcc... 9.4.0 checking if this is really Intel C compiler... no checking if this is really Clang C compiler... no checking for gcc option to accept ANSI C... none needed checking $CFLAGS variable... ok checking $CC variable... ok checking for ggrep... no checking for grep... grep checking for egrep... grep -E checking how to run the C preprocessor... gcc -E checking if preprocessor (gcc -E) has -C comment-option... yes checking for reflex... no checking for flex... flex checking for yywrap in -lfl... no checking for yywrap in -ll... no checking lex output file root... flex: fatal internal error, exec of /usr/local/bin/m4 failed lex.yy checking whether yytext is a pointer... no checking whether make sets ${MAKE}... yes checking for byacc... no checking for bison... bison -y checking for a BSD compatible install... /usr/bin/install -c checking if filesystem supports mixed-case filenames... yes checking for exctags... no checking for ctags... no checking for exetags... no checking for etags... no checking for ctags... no checking for etags... no checking for lint... no checking for cppcheck... no checking for splint... no checking for gperf... no checking if the POSIX test-macros are already defined... no checking if this is the GNU C library... yes checking if _DEFAULT_SOURCE can be used as a basis... yes checking if _XOPEN_SOURCE=500 works with _DEFAULT_SOURCE... yes checking if _XOPEN_SOURCE really is set... yes checking for fgrep... grep -F checking if you want to use C11 _Noreturn feature... no checking if you want to turn on gcc warnings... no checking if you want to see long compiling messages... yes checking if you want to enable lint-library (llib) support... yes checking for an ANSI C-conforming const... yes checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether exit is declared... yes checking for unistd.h... (cached) yes checking for getopt.h... yes checking for header declaring getopt variables... unistd.h checking for getopt... yes checking for popen... yes checking for strstr... yes checking for tmpfile... yes checking for link... yes checking for unlink... yes checking for unistd.h... (cached) yes checking for working mkstemp... yes checking for size_t in <sys/types.h> or ... yes checking if gcc -E can handle only .c files... yes bison: m4 subprocess failed: No such file or directory checking for error-reporting with BISON_HAS_YYTNAME... no checking for error-reporting with YACC_HAS_YYTOKS... no checking for error-reporting with YACC_HAS_YYTOKS_2... no checking for error-reporting with YACC_HAS_YYNAME... no checking for conflicting prototype for popen... no checking if you want to use dmalloc for testing... yes checking for dmalloc.h... yes checking for dmalloc_debug in -ldmalloc... no checking if you want to use dbmalloc for testing... no checking if you want to use valgrind for testing... no checking if you want to perform memory-leak testing... yes checking for groff... /usr/bin/groff checking for nroff... /usr/bin/nroff checking for tbl... /usr/bin/tbl checking for man2html... no checking for program to convert manpage to html... /usr/bin/groff setting other definitions configure: creating ./config.status config.status: creating Makefile config.status: creating config.h config.status: config.h is unchanged

make

bison -y ./grammar.y ./grammar.y: warning: 1 conflict shift/output [-Wconflicts-sr] ./grammar.y: warning 32 reduce/reduce conflicts [-Wconflicts-rr] ./grammar.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples bison: subprocess m4 failed with error: No such file or directory make: *** [Makefile:120: y.tab.c] Error 1

bison -y -Wcounterexamples ./grammar.y ./grammar.y: предупреждение: 1 конфликт сдвига/вывода [-Wconflicts-sr] ./grammar.y: предупреждение: 32 reduce/reduce conflicts [-Wconflicts-rr] ./grammar.y: предупреждение: reduce/reduce conflict on tokens '(', T_TYPEDEF_NAME, T_DEFINE_NAME, T_AUTO, T_EXTERN, T_REGISTER, T_STATIC, T_INLINE, T_EXTENSION, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_VOID, T_LONG, T_SHORT, T_SIGNED, T_UNSIGNED, T_ENUM, T_STRUCT, T_UNION, T_Bool, T_Complex, T_Imaginary, T_LONG_DOUBLE, T_VA_LIST, T_TYPE_QUALIFIER, T_BRACKETS, T_ASM, ';', ',', ')' [-Wcounterexamples] time limit exceeded: 6,000000 First example: T_TYPEDEF_NAME • '(' declarator ')' ';' $end First reduce derivation $accept ↳ 0: program $end ↳ 2: translation_unit ↳ 3: external_declaration ↳ 5: declaration ↳ 16: decl_specifiers init_declarator_list ';' ↳ 35: decl_specifier ↳ 70: init_declarator ↳ 38: type_specifier ↳ 72: declarator ↳ 60: T_TYPEDEF_NAME • ↳ 84: direct_declarator ↳ 86: '(' declarator ')' Second example: T_TYPEDEF_NAME • '(' parameter_type_list ')' $@4 opt_declaration_list T_LBRACE T_MATCHRBRACE $end Second reduce derivation $accept ↳ 0: program $end ↳ 2: translation_unit ↳ 3: external_declaration ↳ 6: function_definition ↳ 29: declarator $@4 opt_declaration_list T_LBRACE T_MATCHRBRACE ↳ 84: direct_declarator ↳ 88: direct_declarator '(' parameter_type_list ')' ↳ 85: identifier_or_ref ↳ 107: any_id ↳ 82: T_TYPEDEF_NAME • ./grammar.y: предупреждение: shift/reduce conflict on token T_TYPEDEF_NAME [-Wcounterexamples] Example: any_typedef decl_specifiers • T_TYPEDEF_NAME ';' Shift derivation declaration ↳ 18: any_typedef decl_specifiers $@1 opt_declarator_list ';' ↳ 36: decl_specifiers decl_specifier ↳ 18: ε ↳ 18: ε ↳ 38: type_specifier ↳ 60: • T_TYPEDEF_NAME Example: any_typedef decl_specifiers • T_TYPEDEF_NAME ';' Reduce derivation declaration ↳ 18: any_typedef decl_specifiers $@1 opt_declarator_list ';' ↳ 17: ε • ↳ 22: declarator_list ↳ 23: declarator ↳ 84: direct_declarator ↳ 85: identifier_or_ref ↳ 107: any_id ↳ 82: T_TYPEDEF_NAME

AlexeiKharchev commented 7 months ago

by the way, what is llib project used in cproto? where llib sources I can get?