In the future, I may be more compelled to try my best to fix some flaws in the Mulan Reenactment project and the RPLY repository on which it relies.
mulan
- Support # syntax, equivalent to len(), as in
# [3] capture
The output is 2.At the sight of this submission - When the data structure is output, the internal string is omitted:Set, multinomial;The dictionary. Such as
d={1:'a'}
Print in Python{1: 'a'}
While magnolia output{1: a}
- The module name in the error is null, which is unique. It is not clear from the reverse, and a hard patch has been added to implement the same behavior as the original executable
- Found a few re.dotall before do not understand what, now basically determined that no effect
- [Implemented, unpublished] Improved error message: parameter defaults are incomplete. Like the following function:
func f(x=2, y) { return x }
, Python does not locate specific parameters:non-default argument follows default argument
Mulan can now be located:
😰 syntax error: file "[standard input] ", line 1, column 13, argument" y "before" x "has default value, it also requires an expression specifying default value func f(x=2, ✋y) {return x}Copy the code
- [To be repeated] Mulan supports the definition of a tuple as follows:
a = 3; b = 4; c = (a,b)
“But does not support itC = (3, 4)
. Because of dependence intend inThis reward missionAnd then we’re done.
There are currently three reward missions, welcome to participate.
Dependency library: RPLY Magnolia custom version
From the beginning, rPLY was branched, tailored and published in PyPI with the rPLY – Ulang library.
1. Culture in API
The rPLY API used in Mulan is translated into Chinese, and the results are shown as follows:
The Original English API was directly changed to Chinese, but later it was found that in order to support the normal operation of reverse engineering, the original English API still needs to be retained.
2. Clean up duplicate magnolia code
It was discovered that Mulan made some changes to rPLY’s Parser to support some syntax, and it was decided to incorporate a custom version of RPLY to reduce the amount of code maintenance required to synthesize it.
3. Fix the error column number
For more than half a year, THERE was a problem of error column number in RPLY, but I didn’t see any response. When studying the relevant code part, I made a Chinese culture by the way and added a patch
See the project source library for other customizations.
Attached: code statistics
The main part of the code line statistics, format: last -> now.
- Magnolia code number 3201 -> 3206
- Run environment, implementation and test mostly for magnolia code: 582
- Mulan test case, including some utility miniprograms (e.g., tic-tac-toe) : 2619 -> 2624
- Amount of Python code (Magnolia implementation, test framework, syntax tree generation of Python test code in Magnolia) : 3794 -> 3711
Parsers/parsers. Py
This formatting code has an additional line number: 1144 -> 1159Environment. Py
, define global methods: 275 -> 284Analyzer/lexical analyzer. Py
231 – > 236Test/expected value table.py
177 – > 180Interaction. Py
, Interactive environment (REPL) : 150 -> 149Test /unittest/ error.py
126 – > 127- unchanged
Parser/syntax tree.py
: 267Produce/magnolia.py
: 242Function/feedback. Py
: 175Parser/syntax tree processing.py
: 119In py.
, main program: 95Parser/syntactic component.py
, the enum constant extracted from the parser: 88Test/run all.py
To verify all magnolia test code snippets: 75Test /unittest/ generate.py
, syntax tree generation magnolia source related tests: 60Test /unittest/ syntax tree.py
To ensure that the generated syntax tree is consistent with the original version, split the error part: 58Functions/debugging AIDS. Py
To: 57setup.py
And 34Test /unittest/ interaction.py
, interactive environment related tests: 28Profiler/error.py
28:Test /unittest/ all use cases.py
: 24