JS Interpreter in react

346 views
Skip to first unread message

Nitesh Jha

unread,
Jun 24, 2021, 2:13:25 AM6/24/21
to Blockly
Hello,
I am working on application to add blockly ide to my react webapp. I am converting the block code into JS code and running it using js-interpreter package. But while running this program my app is crashing :var i; for (i = 1; i <= 10; i++) { };  due to unexpected token. 

I don't want my app to crash so is there any way to stop my react app from crashing by identifying error. 
Is there any way to convert my block code into other language so that interpretation would work. 
Please help if anyone has ever worked on this issue. I want to execute block based code and provide an output. thanks in advance. 

 

Neil Fraser

unread,
Jun 24, 2021, 2:30:40 AM6/24/21
to blo...@googlegroups.com
Sorry, it's me again.  :)

This is really a question for the React community, not Blockly nor JS-Interpreter.  Basically, JS-Interpreter throws upon invalid input, and you need to figure out how to do a try/catch in the React framework.

For people from the future with a similar React issue, here's a link to the original bug which might get updated if a solution is found:


--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/960fbc5d-21fd-470e-8015-ee8ea95be541n%40googlegroups.com.


--

Nitesh Jha

unread,
Jun 24, 2021, 2:39:36 AM6/24/21
to Blockly
Thanks Neil Fraser. 
I was wondering is there any other interpreter I can use by converting my block code into other languages like python, Java, or PHP which can help me. I was wondering if anyone could help me with this issue since I am stuck in this project and can't proceed. Thanks in advance.
Thank you 

Reply all
Reply to author
Forward
0 new messages