If you have trouble logging in, try to disable JavaScript temporarily. If that doesn't work, please contact  a d m i n @ c o d e w a l r . u s  with your account nickname.

* WalrusIRC Shoutbox (Support and development thread)

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Duktape - A JavaScript interpreter for the Nspire  (Read 5303 times)

0 Members and 1 Guest are viewing this topic.

Offline Legimet

  • Full User
  • Posts: 39
  • Post Rating Ratio: +0/-0
    • Legimet
    • View Profile
  • Gender: Male
Duktape - A JavaScript interpreter for the Nspire
« on: February 04, 2015, 03:01:18 am »
Hi everyone, I just joined CodeWalrus  :D

This is a port of Duktape, a lightweight JavaScript (ECMAScript) interpreter, to the TI-Nspire.
It can run in interactive mode (NspireIO) or run a .js(.tns) file from the documents screen. To exit from interactive mode type ".exit".
More functions will be added later.

Download: http://ti-pla.net/a153555
Source code: https://github.com/Legimet/duktape-nspire
« Last Edit: December 06, 2015, 08:02:21 pm by Legimet »



Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14612
  • Post Rating Ratio: +72/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #1 on: February 04, 2015, 04:14:44 am »
Hiya and welcome to the forums. :walrii: I saw this on Omni yesterday but I didn't return yet so that was why I didn't reply immediately. It seems very promising. How far into completion is it? Would, for example, simple Javascript-based games (point and click) be useable? Also how is the speed?

New languages are always welcome on the TI-Nspire. With the limitations of TI-BASIC and some people not always liking Lua, sometimes people might have felt there aren't enough alternatives that can suit them. Good job!  :thumbsup:
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Legimet

  • Full User
  • Posts: 39
  • Post Rating Ratio: +0/-0
    • Legimet
    • View Profile
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #2 on: February 04, 2015, 02:46:23 pm »
New languages are always welcome on the TI-Nspire. With the limitations of TI-BASIC and some people not always liking Lua, sometimes people might have felt there aren't enough alternatives that can suit them. Good job!  :thumbsup:

Thanks. I think I'll do a benchmark similar to the one for Micropython (recursively calculate Fibonacci numbers). Duktape doesn't have a JIT but I don't think it should be bad. Games and other stuff should be possible once I add some "Duktape/C" functions for graphics, input, touchpad, etc. Duktape/C functions are native functions that can be called from JS code.

Also Vogtinator said that PyWrite should be easy to use for JS. The syntax highlighting is modular, and duktape.tns can be called in the same way as micropython.tns. Although the name might not fit :P

Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14612
  • Post Rating Ratio: +72/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #3 on: February 04, 2015, 05:11:09 pm »
Do you mean a benchmark to compare the speed of each Nspire language? As for games I was mostly thinking about classic javascript material, as in stuff that would work in Internet Explorer 6 and anything above. I assume that you wouldn't support JQuery and other more modern stuff lol :P

Also nice to see that we can use C in the language. Glad to hear about PyWrite as well. I guess the name should not be a serious issue as long as that feature is clearly documented. Some people might prefer being able to run everything from just 1 software/launcher, like on the 84+ with Doors CS.
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Adriweb

  • Full User
  • CodeWalrus Supporter
  • *
  • Posts: 356
  • Post Rating Ratio: +6/-0
    • Adriweb
    • @Adriweb
    • Adriweb
    • @UC-UIrbk5SuaUCvnV6SQvt-Q
    • /u/Adriweb
    • Adriweb
    • View Profile
    • TI-Planet.org
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #4 on: February 05, 2015, 07:32:39 am »
Note: we (TI-Planet) intend to write a full-fledged news article about it soon, which will be like the MicroPython one (if not directly based on it).
A draft will probably be available on some google docs somewhere, I guess I can invite you on it, Legimet, if you want to participate in its writing :)  *

So, benchmarks and all :)

Also, yeah, jQuery-like bindings so that we can do stuff like : $("calculator").eval("x+x") and $("geometry").newGraph().plot("y1(x)","sin(x)") etc. :P



* PS : like the python one, it will be sent to TI as well - the more we get them to acknowledge good things like those, that can seriously be useful for STEM and learning in general, the better it will be (more chances of getting more support from them in the future, maybe for official support of such things...
« Last Edit: February 05, 2015, 07:35:17 am by Adriweb »
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Offline Cumred_Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Posts: 3057
  • Post Rating Ratio: +30/-1
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #5 on: February 05, 2015, 09:43:11 am »
But javascript != html, right? So why would you need jQuery?  ???
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline Duke "Tape" Eiyeron

  • Urist McEiyolobster
  • Super User
  • Posts: 1636
  • Post Rating Ratio: +11/-2
  • Fanciest Walrus of the oceans.
    • @@Eiyeron
    • Eiyeron
    • /u/Eiyeron
    • Eiyeron
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #6 on: February 05, 2015, 03:58:01 pm »
I think he meant bindings which allows to make fluent expressions : f1().f2().f3()...
  • Calculators owned: A lot.

Offline Cumred_Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Posts: 3057
  • Post Rating Ratio: +30/-1
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #7 on: February 05, 2015, 04:32:21 pm »
ooh, as in like, other apps? So if you'd want to do something with the Grapher $("Grapher")? I think i get it now :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14612
  • Post Rating Ratio: +72/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #8 on: February 05, 2015, 06:15:05 pm »
Also I know that some apps attempted to port HTML to calcs before, so maybe in the future Duktape could be expanded to support minimal HTML or something similar? :P

Anyway, in response to @Adriweb (welcome to CodeWalrus, by the way :) ) I am hoping that this, combined with MicroPython, can help convincing TI that Ndless can be very handy for educational purposes as well. But with their Nspire mentality in the last years, maybe they'll just tell us to port MicroPython and Duktape to the TI-83 Premium CE and TI-84 Plus CE and that they have no plan to open the Nspire to native language programs? <_<
« Last Edit: February 05, 2015, 06:17:11 pm by DJ Omnimaga »
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Cumred_Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Posts: 3057
  • Post Rating Ratio: +30/-1
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #9 on: February 05, 2015, 06:16:12 pm »
While youre at it convincing TI, try to get them to not rename their calculators every minute :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline Duke "Tape" Eiyeron

  • Urist McEiyolobster
  • Super User
  • Posts: 1636
  • Post Rating Ratio: +11/-2
  • Fanciest Walrus of the oceans.
    • @@Eiyeron
    • Eiyeron
    • /u/Eiyeron
    • Eiyeron
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #10 on: February 05, 2015, 07:33:35 pm »
Oh, I know how I would have named this project : Duke Tape. Much better. Quite. (-_(//)):
  • Calculators owned: A lot.

Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14612
  • Post Rating Ratio: +72/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #11 on: February 05, 2015, 07:58:06 pm »
While youre at it convincing TI, try to get them to not rename their calculators every minute :P
Don't you mean hour? :P

http://codewalr.us/index.php?topic=237.0
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Legimet

  • Full User
  • Posts: 39
  • Post Rating Ratio: +0/-0
    • Legimet
    • View Profile
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #12 on: February 07, 2015, 02:14:22 am »
I just uploaded a version compiled with -O3 (it's a little larger, but faster)

Online DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Posts: 14612
  • Post Rating Ratio: +72/-7
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #13 on: February 07, 2015, 02:25:55 am »
By the way, are there code examples that works both on calc and on a computer?
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX, HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Legimet

  • Full User
  • Posts: 39
  • Post Rating Ratio: +0/-0
    • Legimet
    • View Profile
  • Gender: Male
Re: Duktape - A JavaScript interpreter for TI-Nspire calculators
« Reply #14 on: February 07, 2015, 02:55:18 am »
Well, there's always
Code: [Select]
print('Hello world!');
But seriously, an article which will be posted on TI-Planet with code examples. I have to add some modules first (filesystem, graphics, etc.)

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games