You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It'll be useful if a intermedia rewriter exists, which take responsibility to handle the ast that Nim disallows, rewrite Python code to codes valid for pylib to compile, and try to keep it a valid python when possible:
For example:
str literal with single quotes like 'ss' -> u"ss", wrap str literal with double quotation mark with str, e.g. "ss" -> u"ss" (for pylib to handle escape chars)
tabs in indentation -> spaces (tabs are invalid for Nim)
extend slice literal with step 1:10:3 -> slice(1,10,3)...
Uh oh!
There was an error while loading. Please reload this page.
It'll be useful if a intermedia rewriter exists, which take responsibility to handle the ast that Nim disallows, rewrite Python code to codes valid for pylib to compile, and try to keep it a valid python when possible:
For example:
str
, e.g. "ss" -> u"ss" (for pylib to handle escape chars)1:10:3
->slice(1,10,3)
...Above are some examples where the rewritten result is still valid Python, yet handle-able for Nim.
There're also some code that cannot keep valid for python when rewriting, some examples come when it comes to keyword,
e.g.
print("123", end="")
, we cannot keepend
still, as it's a keyword in Nim, so when just have to replace it with others, likeendl
.When developing, I'm trying to mend the difference between Python and Nim's syntax, but there're cases that cannot be avoided.
The text was updated successfully, but these errors were encountered: