Open AnYiFan117 opened 1 year ago
Seems you have syntax error in the YaccParser.py file written in Python 2 syntax. In that case, you may need to update the Python scripts in the Deckard project to be compatible with Python 3, as they all seem to be written in Python 2 syntax. To do this, you can use the 2to3 tool that comes with Python 3 installations.
Seems you have syntax error in the YaccParser.py file written in Python 2 syntax. In that case, you may need to update the Python scripts in the Deckard project to be compatible with Python 3, as they all seem to be written in Python 2 syntax. To do this, you can use the 2to3 tool that comes with Python 3 installations.
thanks!
I tried 2to3.py but it still has an error:
rm -f .pyc
make -C simple clean
make[1]: Entering directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/simple'
rm -f .o lex.yy.cc pt_c.tab pt_c.y head.cc c_ptgen
make[1]: Leaving directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/simple'
make -C gcc clean
make[1]: Entering directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/gcc'
rm -f .o lex.yy.cc pt_c.tab pt_c.y head.cc gccptgen.a
make[1]: Leaving directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/gcc'
make -C java clean
make[1]: Entering directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/java'
rm -f .o lex.yy.cc pt_j.tab pt_j.y head.cc javaptgen.a
make[1]: Leaving directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/java'
make -C php5 clean
make[1]: Entering directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/php5'
rm -f .o lex.yy.cc pt_zend_language_parser.tab pt_zend_language_parser.y head.cc phpptgen.a
make[1]: Leaving directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/php5'
make -C sol clean
make[1]: Entering directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/sol'
rm -f .o lex.yy.cc pt_solidity. head.cc solidityptgen.a
make[1]: Leaving directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/sol'
make -C gcc
make[1]: Entering directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/gcc'
./mainc.py c.y
bison -d pt_c.y -o pt_c.tab.cc
pt_c.y:2.1-12: warning: deprecated directive: ‘%pure-parser’, use ‘%define api.pure’ [-Wdeprecated]
2 | %pure-parser
| ^~~~
| %define api.pure
pt_c.y: warning: 11 shift/reduce conflicts [-Wconflicts-sr]
pt_c.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
pt_c.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
flex -olex.yy.cc c.l
g++ -O3 -I../../include -c -o lex.yy.o lex.yy.cc
g++ -O3 -I../../include -c -o pt_c.tab.o pt_c.tab.cc
pt_c.tab.cc: In function ‘int yyparse()’:
pt_c.tab.cc:12821:20: warning: ISO C++ forbids converting a string constant to ‘char’ [-Wwrite-strings]
12821 | yyerror (YY_("syntax error"));
| ^~~~~~
ptc.tab.cc:520:22: note: in definition of macro ‘YY’
520 | # define YY_(Msgid) Msgid
| ^~~~~
ptc.tab.cc:12932:16: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
12932 | yyerror (YY("memory exhausted"));
| ^~~~~~
ptc.tab.cc:520:22: note: in definition of macro ‘YY’
520 | # define YY_(Msgid) Msgid
| ^~~~~
g++ -O3 -I../../include -c -o head.o head.cc
ar -csrv gccptgen.a lex.yy.o pt_c.tab.o head.o
a - lex.yy.o
a - pt_c.tab.o
a - head.o
make[1]: Leaving directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/gcc'
make -C java
make[1]: Entering directory '/home/ayf/deckard/Deckard-rel2.0solidity/src/ptgen/java'
./mainj.py j.y
(<_io.TextIOWrapper name='pt_j.y' mode='w' encoding='UTF-8'>, '\n%pure-parser\n\n%{\n#include~~
| YYSTATE
j.l:26:27: error: ‘YYSTYPE’ was not declared in this scope; did you mean ‘YYSTATE’?
26 | #define YY_DECL int yylex(YYSTYPE yylvalp)
| ^~~
lex.yy.cc:934:1: note: in expansion of macro ‘YY_DECL’
934 | YY_DECL
| ^~~
j.l:26:36: error: ‘yylvalp’ was not declared in this scope
26 | #define YY_DECL int yylex(YYSTYPE yylvalp)
| ^~~
lex.yy.cc:934:1: note: in expansion of macro ‘YY_DECL’
934 | YY_DECL
| ^~~
make[1]: [
Is it about the version error of bison and flex? Should I use lower version?
Hi , I got this error when running build.sh:
rm -f *.pyc make -C simple clean make[1]: Entering directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/simple' rm -f *.o lex.yy.cc pt_c.tab* pt_c.y head.cc c_ptgen make[1]: Leaving directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/simple' make -C gcc clean make[1]: Entering directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/gcc' rm -f *.o lex.yy.cc pt_c.tab* pt_c.y head.cc gccptgen.a make[1]: Leaving directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/gcc' make -C java clean make[1]: Entering directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/java' rm -f *.o lex.yy.cc pt_j.tab* pt_j.y head.cc javaptgen.a make[1]: Leaving directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/java' make -C php5 clean make[1]: Entering directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/php5' rm -f *.o lex.yy.cc pt_zend_language_parser.tab* pt_zend_language_parser.y head.cc phpptgen.a make[1]: Leaving directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/php5' make -C sol clean make[1]: Entering directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/sol' rm -f *.o lex.yy.cc pt_solidity.* head.cc solidityptgen.a make[1]: Leaving directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/sol' make -C gcc make[1]: Entering directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/gcc' ./mainc.py c.y Traceback (most recent call last): File "/home/ayf/Deckard-rel2.0solidity/src/ptgen/gcc/./mainc.py", line 43, in <module> import YaccParser,YaccLexer File "/home/ayf/Deckard-rel2.0solidity/src/ptgen/gcc/../YaccParser.py", line 8 False = 0 ^^^^^ SyntaxError: cannot assign to False make[1]: *** [Makefile:62: pt_c.y] Error 1 make[1]: Leaving directory '/home/ayf/Deckard-rel2.0solidity/src/ptgen/gcc' make: *** [Makefile:35: TARGET] Error 2 Error: ptgen make failed. Exit. Error: ptgen make failed. Deckard build fails.
it seemed that YaccParser.py assigned to False, which is not accepted in python. Did I have the wrong environment or something went wrong ?