Glowscript 1.1 errors related to break and integer division

47 views
Skip to first unread message

Adam Hausknecht

unread,
Apr 14, 2015, 1:56:25 PM4/14/15
to glowscri...@googlegroups.com
Hi,

I am attempting to convert a VPython program (attached) that uses WxWidgits to a GlowScript 1.1 VPython program. However, I repeatedly get errors of the following type:

"Unterminated regular expression near line 502: h = h // 3"

I also get errors with statements of the type:

   if h == 0: break 

inside a while loop,

Does GlowScript 1.1 VPython support Python classes or should
I use JavaScript objects?

Regards,

Adam Hausknecht
Department of Mathematics
UMass Dartmouth

SortGlowScript_1_1.txt

Bruce Sherwood

unread,
Apr 14, 2015, 4:24:05 PM4/14/15
to glowscri...@googlegroups.com
Thanks for pointing out the problem with "//", which is being misinterpreted by the RapydScript compiler as being a malformed regular expression pattern. I've reported this to the RapydScript group at


After replacing all of your x // y with int(x / y), and replacing one instance of kBubble with kBubbleSort, I don't get any errors (but I don't know whether the program works). I attach the modified program.

GlowScript does indeed support Python classes. See http://rapydscript.pyjeon.com/ or http://www.rapydscript.com for details.
Hausknecht.txt

Adam Hausknecht

unread,
Apr 14, 2015, 5:01:39 PM4/14/15
to glowscri...@googlegroups.com
Thanks for your help! I hope to complete the conversion soon!

Adam 

Bruce Sherwood

unread,
Apr 14, 2015, 11:27:40 PM4/14/15
to glowscri...@googlegroups.com
I should mention that in JavaScript, to which RapydScript compiles, does not have integer variables! For example, you can use a floating point variable to index into an array, as long as that floating point variable's value is an integer. (I'm ignoring here the special JavaScript typed arrays which include byte arrays, integer arrays, etc.)
Reply all
Reply to author
Forward
0 new messages