-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
吾思虑再三,若备一转换之工具,甚美呓。吾之工程,尽为文言呓! #47
Comments
That would be really nice, but would also need a huge amount of work to implement. Think about all the various nuances and tricky details of other languages, and the fact that other languages (especially JavaScript) are constantly evolving themselves. I imagine it could be quite a pain to keep up. Perhaps one day there would be a large enough community of wenyan developers to support this kind of project. I look forward to that day :) |
LLVM might be helpful. There is emscripten (https://github.com/emscripten-core/emscripten) which can compile C/C++ to js. Given the simiarlirties between Wenyan and js, it would be possible to translate js to Wenyan. |
This might be impossible, it's hard to convert the JavaScript to LLVM IR, however the reverse is done. Thus the LLVM IR to wenyan is meaningful a use case that C/C++ into wenyan, but that won't work for converting JS to wenyan. |
@yorkie Let me rephrase: we can convert c/c++ to LLVM IR. And we also know that we can convert LLVM IR to js (using emscripten). Since js shares some similarities with Wenyan, it is possible to modify emscripten and generate Wenyan, instread of js. I should not have used the word translate js to Wenyan |
You actually said it as it's possible, aha but never mind :) And yes, we can output "wenyan" from LLVM IR, IMHO I'm a little bit -1 on this idea, the "wenyan"'s good part is to represent a program in Classical Chinese, that means what a programmer now think about the solution to problems in Classical Chinese language model, I'm very inspired on this part :) |
Yep, your idea definitely worths checking out. I, and the person who starts this thread, wish to compile existing programs to Wenyan. For example, we can have OpenSSL in Wenyan. Then people from 1000 years ago can securely communicate with us. I would say this idea to trans-compile, as well as the Wenyan itself, is more for recreational and research purposes rather than actual usage. |
How about developing a tool to take a JS/Java source code, and explain it in Wen Yan. That will make programming or learning how to programming fun. Users can also learn JS/Java etc at the same time improve their Wenyan. |
Isn't it exactly what this title suggests? |
@LingDong- I'm working on one. https://github.com/zxch3n/wenyanizer You can play it online http://zxch3n.github.io/wenyanizer There are still some basic js grammars that are not parsed correctly. But I'm optimistic 😄. (it has passed all the example tests, where it should compile back the compiled wenyan examples, and has the same output as them) When making it, I met some obstacles resulting from the current syntax. I hope the incoming specifications will include the following two things.
PS: I guess we need not keep up with the development of JS specifications. We might only need es5, and use babel to compile all the new things down. |
It turns out I can actually use Currently, I'm using the following way to make function A(arg){
this.arg = arg;
}
const a = new A(123); =>
|
@zxch3n . Nice tricks! Glad you figured it out. I think you can also use |
No description provided.
The text was updated successfully, but these errors were encountered: