amol- / dukpy

Simple JavaScript interpreter for Python
MIT License
479 stars 43 forks source link

dukpy CLI compile updates #69

Closed jgphilpott closed 7 months ago

jgphilpott commented 2 years ago

Hey @amol-

I have put together a ruff copy of the compile updates I was wanting to see. I tried to follow the python -m dukpy lang input output format you suggested in the issue I opened. More work is still required to get this PR fully ready but I wanted to get your input/feedback before doing more.

I have tested it on a few files and it works well! Some other updates could include:

Let me know what you think thus far!

Peace, Jacob Philpott

amol- commented 1 year ago

Uhm, I think this PR is modifying the "dukpy" command, not what happens when you import the dukpy module. Instead I was suggesting we could add a if __name__ == '__main__': section to dukpy/__init__.py so that when python -m dukpy is used it can do things different than running code.

Alternatively, you can also register a dukpy-compile command in setup.py so that we have dukpyto run code and dukpy-compile to transpile code.

jgphilpott commented 1 year ago

Okay @amol- I will look into making some of those changes sometime in the next few weeks and will get back to you. Thanks!