Go over grammar for why there are duplicate (more) reductions.
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- compilers, reverse-engineering
Línea de trabajo
Start with ./bin/uncompyle6 -g test/bytecode_2.5/10_if_else_ternary.pyc and compare the reductions with the older Python 2.7 grammar from git history or uncompyle2. Use git bisect to identify when duplicate rules appeared, then inspect the optional and recursive grammar changes and the more specific grammar selection. Done means the duplicate reductions are explained and the affected deparse no longer emits them.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Consider this deparse:
$ ./bin/uncompyle6 -g test/bytecode_2.5/10_if_else_ternary.pyc
# Python bytecode 2.5 (decompiled from Python 2.6)
# Embedded file name: simple_source/branching/10_if_else_ternary.py
...
exprlist ::= expr
compare ::= expr expr COMPARE_OP
compare ::= expr expr COMPARE_OP
cmp ::= compare
cmp ::= compare
expr ::= cmp
expr ::= cmp
...
In the good old days for Python 2.7 this used to be:
compare ::= expr expr COMPARE_OP
cmp ::= compare
expr ::= cmp
I suspect adding various optional nonterminals, e.g. come_from_opt for Python 3.5 is what caused this. And even here, the optional nonterminals were a result of fixing problems before I realized that python 2.7. structure analysis was needed in Python 3.
It is also possible that the duplication comes from changes to use left-recursive grammars. I read in wikipedia that left-recursive grammars for Early parsers generally gives linear parse time, but perhaps I shouldn't believe wikipedia? Or it could be the other way around, maybe I added a right-recursive rule instead of a left-recursive one. (If that's the case we should fix up spark to warn about right, or is it left, recursive rules.)
Tracking this down can be as simple as a git bisect, or reinstating the old 2.7 grammar say from uncompyle2 which should be in git history.
By the way, we now have ways to better select more specific grammars for sets of Python versions, so that could and should be used.
@moagstar is this something that interests you?
- Lenguaje dominante
- Python
- Estrellas
- 4.3k
- Forks
- 464
- Merge medio
- 10 h 7 min
- PR fusionados (30 d)
- 1
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rocky/python-uncompyle6
-
Works on decompyle3
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
rocky/python-uncompyle6#506 · 1 comentario ·
-
Python 3.8 Volunteer wanted Works on decompyle3
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
rocky/python-uncompyle6#492 · 4 comentarios ·
-
Redundant "else:"AbiertoControl Flow Python 3.8 Volunteer wanted Works on decompyle3
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
rocky/python-uncompyle6#486 ·
-
Missing "While True"AbiertoControl Flow Python 3.8 Volunteer wanted Works on decompyle3
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
rocky/python-uncompyle6#485 · 4 comentarios ·
-
Duplicate Python 3.9+
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
rocky/python-uncompyle6#484 · 9 reacciones ·
Todos los issues de rocky/python-uncompyle6
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
521xueweihan/HelloGitHub#4025 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
aws-samples/sample-per-model-bedrock#321 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
FavioVazquez/showtime#101 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
koush/ha_scrypted#81 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
google/osv-scanner-action#147 ·