I want to make a python interpreter by using Javascript.
Then you can input the python code and the Javascript in the webpage can interpret the code into javascript code and then run the code and return the result.
Because I have not much experience in this area, so I want some advice from the senior.
Thanks very much ...
I want to make a python interpreter by using Javascript.
Then you can input the python code and the Javascript in the webpage can interpret the code into javascript code and then run the code and return the result.
Because I have not much experience in this area, so I want some advice from the senior.
Thanks very much ...
Share Improve this question asked Sep 22, 2016 at 6:08 Xiaotao NieXiaotao Nie 611 silver badge3 bronze badges 3- Better send script to server side and run python code in a controlled environment. – Ming Commented Sep 22, 2016 at 6:12
- Your page is on site or just local application? – Artem Selivanov Commented Sep 22, 2016 at 6:15
- It is a good idea, but i want to use javascript itself to interpret the python code...just like some project in github which uses javascript to interpret the javascript... – Xiaotao Nie Commented Sep 22, 2016 at 6:19
3 Answers
Reset to default 2There are many interpreters and source-to-source pilers that can convert Python to JavaScript. The Skulpt interpreter allows Python source code to run in a web browser on the client-side.
You can use pypyjs, and the detailed procedure is also available.
Well, an interpreter is not really a job for a beginner, also you'd better send the code to server side with AJAX, and then display the result in the page.