Well we can try to learn the lessons from 
[https://github.com/metacraft-labs/py2nim_deprecated](https://github.com/metacraft-labs/py2nim_deprecated)

  * Python code is more dynamic than it looks and even your code doesn't use 
much of Python's dynamic nature, some of your dependencies do.
  * py2nim uses a very clever idea: Run the Python code and inspect the 
types/structures at runtime. Maybe that's too clever, I don't know. In the 
following section I assume that it is.



How would I translate 200_000 lines of Python to Nim? Though nut. I probably 
would write a Python lexer/parser in Nim and translate a Python AST to Nim by 
constructing Nim's AST much like c2nim does it. Inside py2nim I would try to 
detect _project specific_ patterns to make the Nim more correct until it's 
close enough that manual editing of the remaining glitches becomes feasible. 

Reply via email to