-
Notifications
You must be signed in to change notification settings - Fork 20
Made Polycompiler Recursive (aka add bin/merge.py.js) #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ler does not support import expressions
Also, another thing I wanted to change is the actual polylang structure. eval(["console.log('Hello, js!')", "print('Hello, py!')"][(-1 % 2 + 1) >> 1]) or eval(["print('Hello, py!')", "console.log('Hello, js!')"][1|0==2]) |
^ Should be done using |
bin/merge py
Outdated
|
||
def merge_files(python_content, js_content): | ||
# Escape backslashes first, then newlines, then quotes | ||
escaped_python_content = python_content.replace('\\', '\\\\').replace('\n', '\\n').replace('"""', '\\"\\"\\"') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with b64 encoding, this escaping logic could be avoided entirely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would also fix #4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that seems like a good idea if it fixes newline handling then
Also, the compilers should strip comments IMO, to save up space |
Yeah, that sounds good, although I can't really say anything on project direction as this is obviously not my project either... :P |
With minimal changes to the Javascript file (using
require()
instead ofimport
and switching from modules to commonjs) and using the Python implementation from #3 we can make polycompiler able to recursively compile itself. The compiled filebin/merge.py.js
can be executed using both python and nodejs.